1, 传统CGI:
vim /var/www/cgi-bin/hello.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
print "Content-type: text/html\n"
print "Hello World"
chmod a+x hello.py
vim /etc/httpd/conf/httpd.conf
ScriptAlias /cgi-bin/ /var/www/cgi-bin/
2, Mod_Python (http://www.modpython.org/)
wget http://archive.apache.org/dist/httpd/modpython/mod_python-3.3.1.tgz
./configure --with-apxs=/data/apache2221/bin/apxs --with-python=/usr/bin/python
make
make install
vim /etc/httpd/conf.d/python.conf
LoadModule python_module modules/mod_python.so
<Directory /var/www/mod-python>
AddHandler mod_python .py
# mod_python.pub