Every time you start the Apache server, you must enter usrlocalapache2binapachectlstart in the command line to start the server. It is much more difficult than Mysql to start itself in the service. You just found two methods to enable automatic startup at startup, the principles are the same. 1. Put usrlocalapachebinapachectlstart in etcrc. local from r
Every time you start the Apache serverCommandInput/usr/local/apache2/bin/ApachectlStart can be started, which is a lot of trouble compared to Mysql self-starting in the service. I just found two methods to achieve auto-starting at startup, and the principle is the same.
1.
Put/usr/local/apache/bin/apachectl start in/etc/rc. local
It can be seen from the rc. local content that this is a boot script.
#! /Bin/sh
#
# This script will beExECutEd* After * all the other init scripts.
# You can put your own initialization stuff in here if you don't
# Want to do the full Sys V style init stuff.
Touch/Var/lock/SuBsys/local
/Usr/local/apache/bin/apachectl start
2.
Cp/Usr/local/apache/bin/apachectl/etc/rc. d/rc3.d/S80apache
Copy the apache Startup File to rc3.d and rename it to S80apache.
S indicates that the instance is automatically started. On the contrary, K indicates that the instance is not started.
80 represents priority
3.
Register apache as a system service
First, copy the apachectl command to the/etc/rc. d/init. d directory and change itHttpd
Open the httpd file in the editor and go to the first line #! Add the following two lines of text under/bin/sh:
#Chkconfig: 35 70 30
# Description: Apache
Register the service
Chkconfig-DdHttpd
Everything is okay. Start the service.
Service httpd start
The first three numbers in the second row indicate that apache is started under runtime Level 3 and 5, and the second and third indicate the priority configuration of startup and stop, which is irrelevant.