apache+python安装配置V1.0

七月 21st, 2010 Posted in Apache | 阅读次数: 417 次

Author:gaojinbo
Time:2010-7-20

1.安装mod_python
到www.modpython.org下载源码包,解压后进入目录:
./configure –with-apxs=/path/apxs –with-python=/usr/local/lib/python2.6/
make
make install

会在/usr/local/lib/python2.6/site-packages/下生成一个mod_python目录
同时在./src/.libs/下生成了一个mod_python.so,将这个so拷贝到apache的modules目录

在httpd.conf中加入

LoadModule python_module modules/mod_python.so

2.配置

在httpd.conf中加入

<Directory "/www/web/py">

    AllowOverride FileInfo

    AddHandler mod_python .py

    PythonHandler index

    PythonDebug On

    Order allow,deny

    Allow from all

</Directory>

<IfModule alias_module>

ScriptAlias /py/ "/www/web/py/"

</IfModule>

3.测试

vi /www/web/py/index.py
from mod_python import apache
def handler(req):
    req.write("Hello World!")
    return apache.OK

完成!

相关日志:

Tags: ,

6 Responses to “apache+python安装配置V1.0”

  1. 宁怡 Says:

    貌似Python现在很火啊?


  2. admin Says:

    是的,python比较流行,google好多应用都是采用python.


  3. Resources Says:

    Interesting Posts…

    [...]some other related resources on the web that are worth viewing on this subject include[...]…


  4. Related Resources Says:

    My Recommended Websites…

    [...]some new websites on the web we love, even if they are not related to ours. Check them out[...]…


  5. stop panic attacks Says:

    Interesting Article…

    [...]some interesting sites worth visitng. We recommend all our readers go and check these out[...]……


  6. hotel in strasbourg Says:

    Great website…

    [...]we like to honor many other internet sites on the web, even if they aren’t linked to us, by linking to them. Under are some webpages worth checking out[...]………


留下您的脚印