系統版本 :Centos 6.3 X86
Apache : httpd-2.4.9
源碼編譯安裝httpd-2.4.9
下載並解壓依賴包apr-1.5.1、apr-util-1.5.3
wget http://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-1.5.1.tar.gz
wget http://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-util-1.5.3.tar.gz
tar -zxf apr-1.5.1.tar.gz
tar -zxf apr-util-1.5.3.tar.gz
下載並解壓httpd-2.4.9
wget http://mirrors.tuna.tsinghua.edu.cn/apache/httpd/httpd-2.4.9.tar.gz
tar -zxf httpd-2.4.9.tar.gz
移動apr-1.5.1、apr-util-1.5.3到httpd-2.4.9的srclib目錄下
mv apr-1.5.1 httpd-2.4.9/srclib/apr
mv apr-util-1.5.3 httpd-2.4.9/srclib/apr-util
編譯httpd-2.4.9
cd httpd-2.4.9
./configure --prefix=/home/apache
--enable-s 是httpd支持動態加載模塊功能 --enable-rewrite 是httpd有網頁地址重寫功能
make && make install
注:編譯中如果出現錯誤,可下載安裝依賴庫 pcre 和 zlib
進到apache/bin 目錄下, 運行 ./apachectl start
報錯:AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 10.163.10.183. Set the 'ServerName' directive globally to suppress this message
解決方法: vi apache/conf/httpd.conf
找到 ServerName ******:80 一行,修改爲 ServerName localhost:80 保存,ok,再執行 apache/bin/apachectl start apache服務器正常啓動
啓動apache服務: /home/apache/bin/apachectl start
停止apache服務: /home/apache/bin/apachectl stop
加入系統開機自啓動: echo "/home/apache/bin/apachectl start" >> /etc/rc.loacl