天天看點

在Centos中 将apache httpd 服務加入系統服務

1.将apachectl檔案copy到/etc/init.d中,然後再/etc/rc.d/rc5.d中加傳入連結接。

指令如下:

cp /usr/local/apache/bin/apachectl /etc/init.d/httpd

ln -s /etc/init.d/httpd /etc/rc.d/rc5.d/S85httpd
           

2.運作chkconfig –list 發現清單中沒有httpd,通過chkconfig –add httpd來添加,可能會提示httpd服務不支援chkconfig,需要編輯/etc/rc.d/init.d/httpd

添加以下注釋資訊:

# chkconfig: 345 85 15

# description: Activates/Deactivates Apache Web Server
           

345代表哪些linux級别需要啟動httpd, 啟動序号是85, 關閉序号是15

3.運作chkconfig –list,httpd 就存在了,可以使用service httpd start 和 service httpd stop來啟動和停止服務。