标签:
Ubuntu 14.02下编译及配置apache2.4(python CGI):
# 下载apache2.4源码包
wget http://mirrors.cnnic.cn/apache//httpd/httpd-2.4.12.tar.gz
# 安装apr依赖库
apt-get install libapr1 libaprutil1 libapr1-dev libaprutil1-dev
# 解压并编译安装
tar -xvf httpd-2.4.12.tar.gz
cd httpd-2.4.12
./configure --prefix=/usr/local/apache2
make && make install
配置CGI:
将下列两行的注释去掉:
#LoadModule cgid_module modules/mod_cgid.so
# AddHandler cgi-script .py
在/usr/local/apache2/cgi-bin/
中添加test.py
,内容为:
#!/usr/bin/python
print "Content-Type: text/html"
print
print
print "Hello World!"
浏览器中打开链接:http://localhost/cgi-bin/test.py
可以看到输出Hello World!
Ubuntu 14.02下编译及配置apache2.4(python CGI)
标签:
原文地址:http://blog.csdn.net/cashey1991/article/details/45629565