apache2.4.29编译

基于阿里云服务器Centos7.2的Linux系统编译

官网下载源码包
cd /xx/
http://mirrors.shuosc.org/apache//apr/apr-1.6.3.tar.gz

安装apr需要的扩展包
yum  -y install autoconf libtool

tar xf apr-1.6.3.tar.gz

编译APR1.6.9

cd apr-1.6.3

./buildconf

./configure –prefix=/xx/apr
可能会报executing libtool commands rm: cannot remove ‘libtoolT’: No such file ordirectory
解决:进入configure文件注释掉(#)$RM “$cfgfile”所在行即可

make

make install

编译APR-UTIL1.6.1

cd /xx/
wget http://mirror.bit.edu.cn/apache//apr/apr-util-1.6.1.tar.gz

tar xf apr-util-1.6.1.tar.gz

cd apr-util-1.6.1

./configure –prefix=/xx/apr-util –with-apr=/xx/apr

make

make install

编译PCRE8.41

cd /xx/
wget https://ftp.pcre.org/pub/pcre/pcre-8.41.tar.gz

tar xf pcre-8.41.tar.gz

cd pcre-8.41

./configure –prefix=/xx/pcre

make

make install

编译HTTPD2.4.29

cd /xx/
wget http://mirror.bit.edu.cn/apache//httpd/httpd-2.4.29.tar.gz

tar xf  httpd-2.4.29.tar.gz

cd httpd-2.4.29

./configure –prefix=/xx/apache2 –with-apr=/xx/apr –with-apr-util=/xx/apr-util/bin/apu-1-config –with-pcre=/xx/pcre –ebable-so –ebable-rewrite

make

make install

配置apache

cd /xx/apache2/conf

修改httpd.conf主配置文件,取消ServerName的注释(#),并修改为localhost:80

启动apache

/xx/apache/bin/apachectl start

apache2.4.29编译完成!