Sunday, 13 November 2011

Automatic Startup of Apache on Linux Server?

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
      # applicable.
        . . .
      # 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: 
          # chkconfig –-add httpd

  • To start mysql on startup too, use:
         # chkconfig –-add mysqld

  • Reboot Linux to verify Apache starts.

No comments:

Post a Comment

Thanks for your valuable comments.