Oct 221998
 

Apache – starting/stopping

See also Apache topics.

How to start/stop Apache

I wound up with a serious problem today, which could only be resolved with a reboot.   For a description of that incident, please see httpd: could not bind to port 80 – how not to stop a process.

I was playing around with virtual websites, and I was stopping and starting httpd quite a lot.  Unfortunately, I was not stopping it correctly.

The correct way to stop httpd is by issuing the following command:

./apachectl start

To stop httpd, issue the following command:

./apachectl stop

For my system, the above files are located at /usr/local/sbin.

The above process allows active sessions to terminate normally.  If you do a kill or a killall, you are defeating that process.

Restarting Apache

You should not do a HUP on apache to restart it.  Nor should you do a killall -HUP.  See http://httpd.apache.org/docs/stopping.html for details.  If you don’t use the following approach, you risk disconnection of existing clients and missed log file entries.

If you are restarting Apache (i.e. you have modified httpd.conf and want to invoke the changes), you should do this:

/usr/local/sbin/apachectl graceful

  One Response to “Apache – starting/stopping”

  1. I was reading your page and I have found this :

    ###########################################
    The correct way to stop httpd is by issuing the following command:

    ./apachectl start

    To stop httpd, issue the following command:

    ./apachectl stop
    ###########################################

    You have just entered "STOP" for starting your apache in the first line of your sentence.

    " The correct way to START httpd is by …

    Thank you for your article