Restart Apache without closing open connections

After making changes to Apache’s configuration file (httpd.conf), it is necessary to restart Apache for the changes to take effect. A normal restart will close active connections which may cause problems for users.


To restart Apache gracefully without aborting open connections or to start Apache if it is not running:

apachectl graceful

If apachectl is not in your PATH and you don’t know where it is, refer to the recipe Find a file by name to find the location of apachectl, then run it with the fully qualified path, for example:

/usr/local/apache/bin/apachectl graceful

 

About Quinn McHenry

Quinn was one of the original co-founders of Tech-Recipes. He is currently crafting iOS applications as a senior developer at Small Planet Digital in Brooklyn, New York.
View more articles by Quinn McHenry

The Conversation

Follow the reactions below and share your own thoughts.

One Response to “Restart Apache without closing open connections”

  1. October 05, 2012 at 7:09 pm, Deepak said:

    If i do graceful restart and if say someone is downloading a file which will need 15-20 mins, then what happens ?
    1) As a graceful restart apache will wait for the existing connection to close, so what about accepting the new connections, will it serve the new requests ?
    2) If it will wait for the existing connection and wont accept the new connection then there will be downtime for apache.
    2) Does it accepts the new connection and keep the exsting open connection?

    Reply

Leave a Reply