centos7.3編譯安裝http-2.4.27

centos7.3編譯安裝http-2.4.27

相關(guān)安裝包

apr-1.5.2.tar.bz2  
apr-util-1.5.4.tar.bz2  
httpd-2.4.27.tar.bz2

實驗步驟
若是系統(tǒng)之前已安裝httpd服務(wù),建議先關(guān)掉httpd服務(wù)
systemctl stop httpd
1、下載并解壓縮包
cd /root/src
tar -xvf apr-1.5.2.tar.bz2
tar -xvf apr-util-1.5.4.tar.bz2
tar -xvf httpd-2.4.27.tar.bz2
安裝 apr-1.5.2.tar.bz2
2、安裝開發(fā)包組
yum -y groupinstall "Development Tools"
3、安裝apr-1.5.2
cd apr-1.5.2/
./configure --prefix=/app/apr
make && make install
4、安裝apr-util-1.5.4
cd apr-util-1.5.4
./configure --prefix=/app/apr-util --with-apr=/app/apr
make && make install
5、安裝httpd-2.4.27
./configure --prefix=/app/httpd24 --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --with-apr=/app/apr --with-apr-util=/app/apr-util --enable-modules=most --enable-mpms-shared=all --with-mpm=prefork
中間看提示缺什么包裝什么包
make && make install

注意:以上3、4、5也可如下操作:

cd /root/httpd-2.4.27/srclib/
mv apr-1.5.2/httpd-2.4.27/srclib/apr
mv apr-util-1.5.4/httpd-2.4.27/srclib/apr-util
./configure --prefix=/app/httpd24 --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --with-included-apr --enable-modules=most --enable-mpms-shared=all --with-mpm=prefork
make && make install

6、添加PATH路徑
在/etc/profile.d目錄下建一個.sh后綴的文件,編輯內(nèi)容如下:
vim /etc/profile.d/app.sh

export PATH=/app/httpd24/bin:$PATH

./etc/profile.d/app.sh
which -a httpd 可查看服務(wù)的所有PATH路徑
7、添加man幫助文檔
vim /etc/man_db.conf

# every automatically generated MANPATH includes these fields
#
#MANDATORY_MANPATH                      /usr/src/pvm3/man
#
MANDATORY_MANPATH                       /app/httpd24/man

8、編輯主頁文件,顯示你想顯示的內(nèi)容
vim /app/httpd24/htdocs/index.html 可如下:

<html><body><h1>apache24,hello!</h1></body></html>

9、編輯服務(wù)腳本,使其可通過service控制服務(wù)啟動
可復(fù)制centos6.9上httpd(/etc/init.d/httpd)服務(wù)腳本然后進(jìn)行編輯,修改以下幾項如下:

httpd=${HTTPD-/app/httpd24/bin/httpd}
prog=httpd
pidfile=${PIDFILE-/app/httpd24/logs/httpd.pid}
lockfile=${LOCKFILE-/var/lock/subsys/httpd24}

添加服務(wù)
chkconfig --add httpd24
service httpd24 restart
自帶工具apachectl可控制服務(wù)啟動停止
apache start
apache stop

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容