Automatically starting Apache with chkconfig

Posted by Max Dunn Tue, 20 Mar 2007 15:44:00 GMT

It is interesting that Apache 2.2 doesn’t include a startup script that is compatible with the Linux ‘chkconfig’ command. Here is how you fix this:

First, add this information to the top of /usr/local/apache2/bin/apachectl:

# chkconfig: - 85 15
# description: Apache is a World Wide Web server.  \
#              It is used to serve HTML files and CGI.

Then change to /etc/init.d and do:

sudo ln -s /usr/local/apache2/bin/apachectl httpd
sudo /sbin/chkconfig --add httpd
sudo /sbin/chkconfig --level 2345 httpd on

That’s it! Now Apache will start when the computer starts up.

Posted in  | 4 comments

Comments

  1. spadefinger said 295 days later:

    Thank you.

  2. ajlyon said 512 days later:

    Useful hint.

  3. John Stromgren said 702 days later:

    Fabulous! Thanks. jstromgren

  4. fiddi said 787 days later:

    Thank you

    works with Apache 2.2 kubutu 8.01

    here are the first 3 lines of my apachectl

    #!/bin/sh #chkconfig: -85 15 #description: WWW Server

    then in the /etc/init.d

    $ sudo ln -s /usr/local/apache2/bin /apache2 $ sudo chkconfig—add apache2 sudo chkconfig—level 2345 apache2 on

Comments are disabled