1. System Environment: Operating System: RedHatEnterpriseLinuxServerrelease5.4Apache version: httpd-2.2.192, registration service # copy apachectl to the init. d directory [root@www.linuxidc.com ~] # Cp/usr/local/apache2/bin/apachectl/etc/rc. d/init. d/http
1. system environment:
Operating System: Red Hat Enterprise Linux Server release 5.4
Apache version: httpd-2.2.19
2. Registration Service
# Copy apachectl to the init. d directory
Root@www.linuxidc.com ~ # Cp/usr/local/apache2/bin/apachectl/etc/rc. d/init. d/httpd
# Modifying httpd
Root@www.linuxidc.com ~ # Vi httpd
# Find #! /Bin/sh, add the following content in another line, and save (: wq !) Exit.
# Chkconfig: 2345 10 90
# Description: Activates/Deactivates Apache Web Server
[Note]: add # chkconfig: 35 70 30 during the registration process, and then use chkconfig -- add httpd to register the service, the following error is reported: service httpd does not support chkconfig, changed to chkconfig: 2345 can be registered normally.
# Register a service
[Root@www.linuxidc.com init. d] # chkconfig -- add httpd
3. Start and Stop Apache in Service Mode
# Start, restart, and stop services
Start service: service httpd start
Stop service: service httpd stop
Restart: service httpd restart