天天看点

在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来启动和停止服务。