To start Apache automatically, follow these steps:
- Copy Apache startup file to the startup directory:
cp /usr/local/apache/bin/apachectl /etc/init.d/
In my case ‘apachectl’ was at location /usr/sbin/apachectl so I have used
cp /usr/sbin/apachectl /etc/init.d/
- Edit /etc/init.d/apachectl by inserting these 2 lines in bold:
# chkconfig: - 345 85 15
# description: Apache is a Web server used to serve HTML files and CGI.
# Copyright 2000-2005 The Apache Software Foundation or its licensors, as
. . .
# Apache control script designed to allow an easy command line interface
# to controlling Apache. Written by Marc Slemko, 1997/08/23
. . .
- Enable httpd to startup automatically:
- To start mysql on startup too, use:
- Reboot Linux to verify Apache starts.