#編譯安裝Apache2.4#
#httpd依賴于apr-1.4+, apr-util-1.4+, [apr-icon]#
#準(zhǔn)備工作
安裝開發(fā)環(huán)境彪蓬,安裝pcre-devel expat-devel openssl-devel
[#注意#]
使用了 apr 1.6.2 的依賴,所以下面我們必須要用 apr-util 1.6.0 版本捺萌,apr-util 1.6.0不再捆綁安裝 expat 档冬,但又需要 expat 的支持,所以我們得手動先安裝 expat桃纯。不然編譯 apache 的時候會報錯酷誓。
1)編譯安裝 expat
wget https://sourceforge.net/projects/expat/files/expat/2.2.3/expat-2.2.3.tar.bz2
# tar jxf expat-2.2.3.tar.bz2
# cd expat-2.2.3/
# ./configure --prefix=/usr/local/expat
# make && make install
2)編譯apr-util-1.6.1
#./configure \
--prefix=/usr/local/apr-util \
--with-apr=/usr/local/apr \
--with-expat=/usr/local/expat
# make && make install
[#注意#]
(1) apr 下載地址:https://mirrors.aliyun.com/apache/apr/apr-1.6.3.tar.gz
# ./configure --prefix=/usr/local/apr
# make && make install
(2) apr-util 下載地址:https://mirrors.aliyun.com/apache/apr/apr-util-1.6.1.tar.gz
# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
# make && make install
#Httpd2.4編譯安裝#
1)創(chuàng)建用戶
#useradd www -M -s /sbin/nologin
2)解壓
#tar zxvf httpd-2.4.29.tar.gz
#cd ./httpd-2.4.29
3)配置
#./configure \
--prefix=/apps/apache \
--sysconfdir=/etc/httpd24 \
--enable-so \
--enable-ssl \
--enable-cgi \
--enable-rewrite \
--with-zlib \
--with-pcre \
--with-apr=/usr/local/apr \
--with-apr-util=/usr/local/apr-util/ \
--enable-mpms-shared=all \
--with-mpm=event \
--enable-modules=most
4)編譯及安裝
# make && make install
[安裝完之后的事]
1)打開ServerName
#vim /etc/httpd24/httpd.conf
#ServerName localhost:80
2)開放防火墻80端口
#vim /etc/sysconfig/iptables
#添加 -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
3)添加到環(huán)境變量
#echo "PATH=/apps/apache/bin:\$PATH" > /etc/profile.d/httpd.sh
#source /etc/profile