Tuesday, March 17, 2015

CentOS 6 and Auto Starting Apache httpd at Boot


Setting Apache To Automatically Start on Boot

Recently I had to install 11 Cent OS servers. These servers were to be all identical and were installed using the simple "web server" option during installation time. 
The servers all had Apache 2.0 installed but the service httpd was not set to start automatically with the system. After applying the SSL certificate to all 11 servers, I wanted to test the installation by simply rebooting the servers to be sure the settings took and stuck.  
Setting Apache httpd to start automatically is simple. This also works with Cent OS 5 (outdated but just in case you need to deploy version 5 for some reason it is good to know). 




Setting Apache To Auto-Start on Boot

Step 1 – Check to ensure the httpd service (Apache) is installed

[root#] chkconfig --list|grep http

If installed properly, you will see as the output of the command above

[root#] 0:off  1:off  2:off 3:off 4:off 5:off 6:off

Step 2 – Set httpd (Apache) to auto start with the system when re-booted. 


[root#] chkconfig httpd on

Step 3 – Confirm the Apache httpd service is set to auto-start 

Run the same command from Step 1 to see that httpd is set to auto-start
[root#] chkconfig --list|grep http
and will see as the output of the command :
[root#] 0:off  1:off  2:on 3:on 4:on 5:on 6:off

That's it, you're done.  I ran the commands on all servers and they all worked after rebooting. 
Apache httpd started with the system after rebooting. 







No comments: