python+apache初探

来源:互联网 发布:linux如何查看log文件 编辑:程序博客网 时间:2024/06/05 15:29
 python的web开发:
apache 2.0.59
mod_apache 3.3.1
一:install apache:
./configure --prefix=/home/apache --enable-suexec --with-suexec-bin=/usr/sbin/suexec --enable-so --enable-rewrite --enable-mime --enable-mime-magic --with-mpm=worker --enable-modules=most --enable-mods-shared=all --enable-rule=SHARED_COR
make;make install
二:install mod_apache
./configure --with-apxs=/homeapache/bin/apxs --with-python=/usr/local/bin/python2.5 --with-max-locks=32

make;make install
三:config apache-httpd.conf
     insert it
     LoadModule python_module modules/mod_python.so
     <Directory /home/apache/htdocs/test>
       AllowOverride FileInfo
       AddHandler mod_python .py
       PythonHandler mptest
       PythonDebug On
     </Directory>
       注意一定要加上AllowOverride FileInfo否则脚本无法正常显示,通常回提示no found module:mptest
四:check
       from mod_python import apache
       def handler(req):
              req.write("its ok!!")
              return apache.OK