美文网首页
CGI - Common Gateway Interface

CGI - Common Gateway Interface

作者: cutelittlePanda | 来源:发表于2017-06-15 20:58 被阅读0次

Pre-Condition:

Install Apache2, setup system path, register httpd as a service:

httpd -k install

The CGIHTTPServer module has been MERGED into http.server in Python 3

httpd usage;

Running a Simple CGI Web Server with python3 on windows via Apache2

1. Update httpd.conf , define SRVROOT to the apache2 home path, make sure cgi_module loaded, and uncommit 'AddHandler' after adding '.py' to it;

#

# ServerRoot: The top of the directory tree under which the server's

#

Define SRVROOT "G:\Apache24"

ServerRoot "${SRVROOT}"

AddHandler cgi-script .cgi .pl .py

LoadModule cgi_module modules/mod_cgi.so

2). restart Apache2 service;

3). put 'hello.py' script under path '%SRVROOT%/cgi-bin/', the script content:

sample;

4). open 'http://localhost/cgi-bin/hello.py' with browser, it works!

相关文章

网友评论

      本文标题:CGI - Common Gateway Interface

      本文链接:https://www.haomeiwen.com/subject/ybdeqxtx.html