Cento OS7编译安装Apache后设为服务并开机启动

编译安装Apache后切换到安装目录下的bin目录执行以下命令

#  cp apachectl /etc/init.d/httpd  --复制apachectl到/etc/init.d/并命名为httpd

#  cp apachectl /usr/local/bin/httpd

#  ln -s /etc/init.d/httpd  /etc/rc.d/rc5.d/S61httpd

#  ln -s /etc/init.d/httpd  /etc/rc.d/rc4.d/S61httpd

#  ln -s /etc/init.d/httpd  /etc/rc.d/rc3.d/S61httpd

 打开/etc/init.d/httpd文件,在#!/bin/sh下面加入如下代码

  #chkconfig:345 61 61 

  #description:Apache

 注册服务

sudo chkconfig --add httpd

 设为开机启动

sudo chkconfig --levels 345 httpd on
如果您觉得我的文章给了您帮助,请为我买一杯饮料吧!以下是我的支付宝,意思一下我将非常感激!

猜你喜欢

转载自bewithme.iteye.com/blog/2288508
今日推荐