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
完成!
七月 22nd, 2010 at 20:46
貌似Python现在很火啊?
七月 23rd, 2010 at 08:22
是的,python比较流行,google好多应用都是采用python.
五月 9th, 2011 at 20:16
Interesting Posts…
[...]some other related resources on the web that are worth viewing on this subject include[...]…
五月 12th, 2011 at 07:37
My Recommended Websites…
[...]some new websites on the web we love, even if they are not related to ours. Check them out[...]…
六月 17th, 2011 at 06:44
Interesting Article…
[...]some interesting sites worth visitng. We recommend all our readers go and check these out[...]……
八月 18th, 2011 at 07:19
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[...]………