当前位置: > Linux服务器 > apache >

学习apache2.4的编译安装

时间:2014-10-18 19:14来源:linux.it.net.cn 作者:it

apache 2.4已经不自带apr库,需要独立安装才行:
 

复制代码代码如下:
wget http://labs.mop.com/apache-mirror/httpd/httpd-2.4.3.tar.gz
wget http://labs.mop.com/apache-mirror/apr/apr-1.4.6.tar.gz
wget http://labs.mop.com/apache-mirror/apr/apr-util-1.4.1.tar.gz
 
tar xzf httpd-2.4.3.tar.gz
tar xzf apr-1.4.6.tar.gz
tar xzf apr-util-1.4.1.tar.gz
 
mv apr-1.4.6 httpd-2.4.3/srclib/apr
mv apr-util-1.4.1 httpd-2.4.3/srclib/apr-util 
 
cd httpd-2.4.3
./configure --with-included-apr --with-php --with-mysql --with-suse xec --disable-info --with-mpm=prefork --enable-so --enable-cgi --enable-rewrite --enable-ssl --enable-mime-magic --enable-unique-id --enable-mods-shared=all --enable-ssl=shared --enable-proxy --enable-proxy-connect --enable-proxy-ftp --enable-proxy-http
#注意去除空格
make
make install

注意
不要指定--prefix=/app/apache,否则出现error: cannot install `libaprutil-1.la' to a directory not ending in /usr/local/apache2/lib。
因为编译使用了shared modules,必须添加LoadModule authz_host_module modules/mod_authz_host.so,否则出现 Invalid command 'Order', perhaps misspelled or defined by a module not included in the server config 。

验证apxs安装
 

复制代码代码如下:

/usr/local/apache2/bin/apxs -c -i
cp -f build/rpm/httpd.init /etc/init.d/httpd
chmod +x /etc/init.d/httpd
chkconfig --add httpd chkconfig httpd on

cd /etc
mv httpd httpd_old
mkdir -p httpd/conf.d
ln -s /usr/local/apache/conf httpd/conf

cd /usr/sbin/
ln -fs /usr/local/apache/bin/httpd
ln -fs /usr/local/apache/bin/apachectl

cd /var/log
rm -rf httpd/
ln -s /usr/local/apache/logs httpd


(责任编辑:IT)
------分隔线----------------------------