下載源碼包 make && make
install 之后, apache 并不會自動往 init.d 里面添加自己的 httpd service。需要手工把 apache 安裝目錄的
bin/apachectl 拷貝一份到 /etc/init.d/httpd 。如果想讓 httpd
service 能夠在不同的運(yùn)行級別下都能自動啟動,還需要 vi
/etc/init.d/httpd ,在 #!/bin/sh 下面增加幾行 chkconfig
需要的內(nèi)容:
# chkconfig: 2345
70 30
# description: Apache is a World Wide Web server. It is used to serve
\
# HTML files and CGI.
# processname: httpd
關(guān)鍵是 chkconfig: 2345 70 30 這一行,第一個(gè)數(shù)字
2345 表示讓 apache 在 2345 這四個(gè)級別都自動運(yùn)行;第二個(gè)數(shù)字 70
表示進(jìn)程啟動的優(yōu)先級;第三個(gè)數(shù)字 30 表示進(jìn)程停止的優(yōu)先級。修改保存之后執(zhí)行 /sbin/chkconfig httpd reset
,chkconfig 就自動在各個(gè)級別的 rc*.d 中增加 httpd 的 link 。要查看 chkconfig 是否 reset 正確,通過命令
/sbin/chkconfig --list httpd
就可以查看當(dāng)前 httpd service 被配置在哪幾個(gè)運(yùn)行級別自啟動。
chkconfig --add httpd
chkconfig --del httpd
chkconfig httpd on //默認(rèn)2345