標籤:with most 手冊 pmp images 機制 環境變數 原因 nbsp
1.安裝編譯工具
[[email protected] httpd-2.4.25]# yum groupinstall ‘Development Tools‘ ‘Server Platform Development‘
2.安裝httpd所依賴的軟體包
yum install -y apr-devel apr-util-devel openssl-devel libevent-devel pcre-devel
3.解壓編譯
./configure --prefix=/usr/local/apache24 --sysconfdir=/etc/httpd24 --enable-so --enable-ssl --enable-cgi --enable-rewrite --enable-modules=most --enable-mpms-shared=all --with-pmp=prefork --with-zlib --with-pcre --with-apr=/usr --with-apr-util=/usr
編譯說明
--prefix 指明程式安裝目錄--sysconfdir 指明設定檔存放目錄--enable-so 表示啟用模組的動態裝卸載功能--enable-ssl 表示啟用ssl功能,此項可能需要先安裝openssl-devel包--enable-cgi 表示啟用支援cgi機制的功能--enable-rewrite 表示支援url重寫功能--enable-modules=most 表示啟用的http模組有哪些,most表示啟動大多數--enable-mpms-shared=all 表示以共用方式啟用哪些MPM模組(prefork、worker、event), all表示所有的,此項為httpd2.4專屬的選項,因為只有2.4才支援MPM的動態裝卸載,2.2的MPM為靜態,只有編譯進去,才能使用--with-pmp=prefork 表示預設啟動的MPM是哪種--with-zlib 表示依賴zlib,用於支援壓縮功能 沒用=等號指明zlib的路徑,則系統會自動到被依賴的檔案的預設的路徑去尋找, 如果被依賴的檔案不是rpm安裝,或不放在預設路徑下,則需要手動利用=等號指明路徑--with-pcre 表示依賴的pcre,用於支援url重寫時支援Regex--with-apr 依賴的apr--with-apr-util 依賴的apr-util
雙核編譯開始
[[email protected] httpd-2.4.25]# make -j 2 && make install
4.匯出PATH環境變數,標頭檔和man手冊所在路徑
[[email protected] httpd-2.4.25]# echo "export PATH=/usr/local/apache24/bin:$PATH" > /etc/profile.d/httpd24.sh[[email protected] httpd-2.4.25]# ln -sv /usr/local/apache24/include/ /usr/include/http24‘/usr/include/http24’ -> ‘/usr/local/apache24/include/’[[email protected] httpd-2.4.25]# echo "MANDATORY_MANPATH /usr/local/apache24/man" >> /etc/man_db.conf
[[email protected] httpd-2.4.25]# source /etc/profile.d/httpd24.sh
5.啟動apache
錯誤原因是servername未配置,通過ss命令可以看見apache已經監聽在80連接埠
centos7.2下編譯安裝apache2.4