2015年1月

软件下载地址:
http://apache.dataguru.cn/apr/apr-1.5.1.tar.gz
http://apache.dataguru.cn/apr/apr-util-1.5.4.tar.gz
http://apache.dataguru.cn/httpd/httpd-2.4.10.tar.bz2

1、安装依赖:
yum install gcc pcre-devel
缺少gcc在编译apr时会出现错误:

no acceptable C compiler found in $PATH

缺少pcre-devel在编译Apache时会出现错误:

configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/


2、安装apr

tar xvf apr-1.5.1.tar.gz
cd apr-1.5.1
./configure --prefix=/usr/local/apr
make
make install


3、安装apr-util

tar xvf apr-util-1.5.4.tar.gz
cd apr-util-1.5.4
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make
make install


4、Apache编译

./configure --prefix=/usr/local/apache --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util

默认会把所有自带的modules都编译进去,以后需要的时候只要在httpd.conf里打开就行了

5、使Apache支持FastCGI(mod_fcgid)

wget http://apache.fayea.com//httpd/mod_fcgid/mod_fcgid-2.3.9.tar.gz
tar xvf mod_fcgid-2.3.9.tar.gz
cd cd mod_fcgid-2.3.9
APXS=/usr/local/apache/bin/apxs ./configure.apxs
make
make install

然后可以在/usr/local/apache/modules/看到有mod_fcgid.so文件