How To Reboot the Apache Server Safely

What do you do when your server freezes? The following tutorial explains the safest steps for rebooting your Apache web server.


This is a common occurrence for many users: You try to access your site and nothing works. You can ping and log in through your shell, but Apache will not provide any information. Here is how to fix it.

Short Version:

    1. Log in as root.
    2. Try apachectl graceful.
    3. If this does not work, try apachectl stop
    4. ps -ef | grep http
    5. apachectl start

Long Version:

    1. Log in and obtain root.
    2. Type in apachectl graceful and hit Enter. This attempts to reboot Apache “gracefully” and is the safest way to reboot the server.
    3. Try to access your web server again. If Apache is locked, often the “graceful” restart will not work. Wait a minute or two, and refresh the site to see if Apache works again.
    4. If the “graceful” reboot does not work, then you will need to try a more aggressive approach. Rebooting this way increases your risk of error; however, if Apache is frozen, you are not accessing much data anyway.
    5. Type in apachectl stop, and hit Enter. This will bring Apache completely down.
    6. Type in ps -ef | grep http , and hit Enter.
    You should see no httpd’s running which is to ensure that Apache is completely shutdown.
    7. Type in apachectl start to restart the web server again.
    8. You can refresh your site, and it should slowly come back up.

The Conversation

Follow the reactions below and share your own thoughts.

One Response to “How To Reboot the Apache Server Safely”

  1. February 08, 2012 at 3:30 am, ashok babu said:

    After stopping the apache webserver, if still httpd process are running , whwt we have to do?

    Reply

Leave a Reply