Register Apache as a system service in RedHatLinux

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.