apache mod_python psp
Feb202014
作者:2hei 发布:2014-02-20 13:40 分类:python 阅读:7,224 views apache mod_python psp已关闭评论
之前在apache上用python都是通过cgi的方式来调用,这次尝试了一下mod_python模块。
yum安装apache,python,mod_python。
安装过程忽略。
注意python的默认版本,如果有多个版本的话,mod_python还是使用的系统的版本。
修改apache配置:
vi httpd.conf
LoadModule python_module modules/mod_python.so
其他配置:
Alias /mysite"/var/www/html/2hei.net/" <Directory "/var/www/html/2hei.net"> AuthType Basic AuthBasicProvider ldap AuthzLDAPAuthoritative off AuthName “LDAPLogin Page" AuthLDAPURL "ldap://ldaps.yourdomain.com/ou=Users,dc=yourdomain,dc=com?uid?" Require valid-user Options FollowSymLinks MultiViews AllowOverride AuthConfig Order allow,deny allow from all AddHandler mod_python .psp .psp_ PythonHandler mod_python.psp PythonDebug Off </Directory>
测试页面
cat test.psp <html> <% import sys %> Your PYTHON Vesriosn is <%=sys.version %> </html>
网上说需要用到handler,如下,但实际中并没有用到。
cat mod_python.psp
from mod_python import apache def handler(req): req.write("Hello world!") return apache.OK
最活跃的读者