环境:centos5 特惠vps主机
步骤:
1、使用yum命令安装mod_python模块
yum -y install mod_python
2、让配置让apache配置文件
cp /etc/httpd/conf.d/python.conf /etc/httpd/conf.d/python.conf_orig
cat /dev/null > /etc/httpd/conf.d/python.conf
vi /etc/httpd/conf.d/python.confLoadModule python_module modules/mod_python.so
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
AddHandler mod_python .py
PythonHandler mod_python.publisher
PythonDebug On
3、重启httpd
/etc/init.d/httpd restart
4、测试python是否启用
vi /var/www/html/test.py
def index(req):
return "Test successful";
保存后使用游览器访问:http://你的vps主机ip地址/test.py ,如果看到Test successful 就代表配置成功。
没有评论:
发表评论