Linux下Apache+Python环境搭建

一.环境说明
1.系统环境
CentOS release 5.4 (Final)

2.软件版本
Apache 2.2.3
Python 2.6.6
mod_python 3.3.1

二.安装Apache
1.如果使用Apache源码进行安装,请到http://httpd.apache.org下载所需版本。
安装过程略。

2.如果使用系统自带的Apache,则需要查看系统是否安装httpd-devel包。操作如下:
# yum list httpd-devel
如果已安装,则跳过以下步骤:
# yum search httpd-devel
# yum install httpd-devel.x86_64

三.安装Python
# tar -jxvf Python-2.6.6.tar.bz2
# cd Python-2.6.6
# CCSHARED="-fPIC" ./configure
# vi Makefile
如果CC= gcc -pthread,则修改为CC= gcc -pthread -fPIC
# make
# make install
注意:Python的安装目录是/usr/local/lib/python2.6/

四.安装mod_python
# tar -xvf mod_python-3.3.1.tar
# cd mod_python-3.3.1
# whereis apxs
apxs: /usr/sbin/apxs /usr/share/man/man8/apxs.8.gz
# ./configure --with-apxs=/usr/sbin/apxs --with-python=/usr/local/bin/python
# make
# make install(/usr/local/lib/python2.6/site-packages/mod_python)
注意:如果没有源码包请到http://www.modpython.org/下载

五.配置Apache
# cd src
# cp mod_python.so /etc/httpd/modules/
# cd /etc/httpd/conf
# vi httpd.conf
添加LoadModule python_module modules/mod_python.so
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值