1.将apache启动文件复制到/etc/init.d/下,改名为httpd
cp bin/apachectl /etc/init.d/httpd
2.修改httpd文件,在 #!/bin/sh 下添加这两行
#chkconfig:345 85 15
#description:Start and stop the Apache HTTP Server
3.将httpd添加到开机自动启动
chkconfig --add httpd
4.设置成功,重启服务器后apache自动启动