How Do You Get Apache Web Service to Start Automatically after a Reboot of a CentOS Linux Server?

Problem scenario  
You have to manually start Apache web server every time you do reboot the server.  You want the Apache web service to start automatically.

1.  Edit /etc/crontab.  Add the lowest line of these two (the line above is for reference):

# *  *  *  *  * user-name  command to be executed
@reboot         root       apachectl start

2.  Save the changes.  You are done.

This solution only works if you are doing a warm (or soft) reboot.  A start up from a turned-off machine will not have the Apache web service running because of this crontab entry.  A crontab would not be needed if your solution could allow the Apache web service to start automatically after a cold (or hard) boot up and a warm (or soft) reboot.  For a solution like this, see this link.

Leave a comment

Your email address will not be published. Required fields are marked *