httpd-2.2.6.tar.bz2 放置於 /soft 目錄cd /soft
tar jxvf httpd-2.2.6.tar.bz2
cd httpd-2.2.6
# 查看配置選項
./configure --help | more
# 配置:指定安裝路徑、啟用 DSO 模組支援
./configure --prefix=/usr/local/apache --enable-so
# 編譯與安裝
make
make install
cd /usr/local/apache/conf
cp httpd.conf httpd.conf.bak
chkconfig --list httpd
chkconfig httpd off
service httpd stop
/usr/local/apache/bin/apachectl -k start
netstat -an | grep :80
ps -aux | grep httpd
cp /usr/local/apache/bin/apachectl /etc/rc.d/init.d/apache
vi /etc/rc.d/init.d/apache
# 在 #!/bin/sh 下方新增:
#chkconfig: 2345 85 15
chkconfig --add apache
chkconfig --list apache
# 測試服務控制
service apache stop
netstat -an | grep :80
service apache start
瀏覽器訪問伺服器 IP,若出現 Apache 預設歡迎頁面(原文誤寫為 Tomcat 頁面),即表示安裝成功。
ps -aux | grep httpd 後 kill 掉iptables -I INPUT -p tcp --dport 80 -j ACCEPT