RedHat Linux下注册Apache为系统服务

wudi 2011-06-18

1、系统环境:

操作系统:Red Hat Enterprise Linux Server release 5.4

Apache版本:httpd-2.2.19

2、注册服务

#将apachectl复制到init.d目录下

#修改httpd

#找到#!/bin/sh,另起一行增加以下内容,并保存(:wq!)退出。

# chkconfig: 2345 10 90

# description: Activates/Deactivates Apache Web Server

【说明】:在注册过程中增加#chkconfig:35 70 30,再通过chkconfig --add httpd注册服务时,报如下错误service httpd does not support chkconfig,修改为chkconfig: 2345 10 90即可正常注册。

#注册服务

3、通过服务方式启动、停止Apache

#启动、重启、停止服务

启动服务:service httpd start

停止服务:service httpd stop

重新启动:service httpd restart

相关推荐

lionelf / 0评论 2020-07-28