红联Linux门户
Linux帮助
当前位置: 红联Linux门户 > Ubuntu

在Ubuntu 7.10中使用Apache2 & Mod_Python

发布时间:2007-10-22 10:22:41来源:红联作者:features
安装:
sudo apt-get install apache2

sudo apt-get install libapache2-mod-python

设置:

允许Mod_Python

cd /etc/apache2/mods-enabled/
sudo ln -s ../mods-available/mod_python.load mod_python.load

修改apache2配置文件
cd /etc/apache2/sites-available/
sudo gedit default

On line 10 you should have:


Options Indexes FollowSymLinks MultiViews
AllowOverride AuthConfig
Order allow,deny
allow from all
# Uncomment this directive is you want to see apache2's
# default start page (in /apache2-default) when you go to /
#RedirectMatch ^/$ /apache2-default/


Change it to:


Options Indexes FollowSymLinks MultiViews
AllowOverride AuthConfig
Order allow,deny
allow from all

AddHandler mod_python .py
PythonHandler mod_python.publisher
PythonDebug On

# Uncomment this directive is you want to see apache2's
# default start page (in /apache2-default) when you go to /
#RedirectMatch ^/$ /apache2-default/


重启apache2服务
sudo /etc/init.d/apache2 restart

测试:
sudo gedit /var/www/test.py

内容:
def index(req):
return "Test successful";
文章评论

共有 0 条评论