天天看點

編譯安裝httpd 2.4

CentOS 6.9

(1)關閉SELINUX

Note:如果不關閉SELINUX,在設定DocumentRoot的時候可能會出現Forbidden等各種不可預知的問題
#sed  -i 's/^SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config           

(2)關閉IPTABLES和添加系統使用者

也可以打開80端口,這裡為了測試友善就直接關閉
# /etc/init.d/iptables stop
# groupadd -r apache
# useradd -r -g apache apache           

(3)需要的依賴包

# yum -y groupinstall "Development tools" "Server Platform Development"
# yum -y install pcre-devel
# yum -y install expat-devel           

(4)下載下傳安裝包

wget https://mirrors.aliyun.com/apache/httpd/httpd-2.4.29.tar.gz https://mirrors.aliyun.com/apache/apr/apr-1.6.3.tar.gz https://mirrors.aliyun.com/apache/apr/apr-util-1.6.1.tar.gz           

(5)安裝apr

# tar xf apr-1.6.3.tar.gz
# apr-1.6.3
# ./configure --prefix=/usr/local/apr
# make && make install           

(6)安裝apr-util

# tar xf apr-util-1.6.1.tar.gz 
# cd apr-util-1.6.1
# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/
# make && make install           

(7)安裝httpd

# tar xf httpd-2.4.29.tar.gz 
# cd httpd-2.4.29
# ./configure --prefix=/usr/local/apache --sysconf=/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-modules=most --enable-mpms-shared=all --with-mem=event --libdir=/usr/lib64           
# echo 'export PATH=/usr/local/apache/bin/apachectl:$PATH' > /etc/profile.d/httpd.sh           
# apachectl -k start           
ss -tnl