Apache is automatically started when Linux is started.

Source: Internet
Author: User
Tags stop script
Article Title: Enable Apache to be automatically started when Linux is started. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

The following is a summary of how to enable Apache to start with Linux:

1 cd/etc/init. d

2 vi apache2

3. paste the following code

==========================================================
#! /Bin/sh
# Description: Apache auto start-stop script.

# Chkconfig:-85 15
APACHE_HOME =/usr/local/apache2
APACHE_OWNER = root
If [! -F "$ APACHE_HOME/bin/apachectl"]
Then
Echo "Apache startup: cannot start"
Exit
Fi
Case "$1" in
'Start ')
Su-$ APACHE_OWNER-c "$ APACHE_HOME/bin/apachectl start"
;;
'Stop ')
Su-$ APACHE_OWNER-c "$ APACHE_HOME/bin/apachectl stop"
;;
'Restart ')
Su-$ APACHE_OWNER-c "$ APACHE_HOME/bin/apachectl restart"
;;
Esac
==========================================================

4 chmod + x apache2

5 chkconfig -- add apache2

6 chkconfig-level 345 apache2 on

7 service apache2 start apache server

8. Restart Linux and verify that Apache is started with Linux.

If the above operations are correct, the result should be OK!


 

Related Article

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.