编译安装Apache后切换到安装目录下的bin目录执行以下命令
# cp 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