Linux下将Apache(httpd)新增为系统服务及开机自启动

1、 查看一下/etc/init.d/下是否存在httpd这个服务

ls /etc/init.d/ | grep httpd 如果没有执行下一步

2、将自己安装目录下的apachect1复制到该目录下并改为httpd

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

3、执行 chkconfig --add httpd 目的是想新增所制定的系统服务 但是会出现以下警告:

[root@server ~]# chkconfig --add httpd
service httpd does not support chkconfig

这里说的是httpd服务不支持chkconfig , 添加支持: vi /etc/init.d/httpd 在 #!/bin/sh 下添加这两句:

#chkconfig:345 85 15

#description:Start and stop the Apache HTTP Server 最终结果为:

[root@server ~]# vi /etc/init.d/httpd
#!/bin/sh
#
#chkconfig:345 85 15
#
#description:Start and stop the Apache HTTP Server
#

4> 执行:

chkconfig --add httpd

chkconfig httpd on 就可以添加成功了

5>查看一下是否添加成功:

[root@server ~]# chkconfig --list httpd
httpd           0:off   1:off   2:on    3:on    4:on    5:on    6:off

  

转载于:https://www.cnblogs.com/rnckty/p/4560608.html

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值