1.6. Starting, Stopping, and Restarting Apache
Problem
You want to be able to start and stop the server at need, using the appropriate tools.
Solution
On Unixish systems, use the apachectl script; on Windows, use the options in the Apache folder of the Start menu.
Discussion
The basic Apache package includes tools to make it easy to control the server. For Unixish systems, this is usually a script called apachectl, but prepackaged distributions may replace or rename it. It can only perform one action at a time, and the action is specified by the argument on the command line. The options of interest are:
apachectl startThis will start the server if it isn’t already running. If it is running, this option has no effect and may produce a warning message.
apachectl gracefulThis option causes the server to reload its configuration files and gracefully restart its operation. Any current connections in progress are allowed to complete. The server will be started if it isn’t running.
apachectl restartLike the
gracefuloption, this one makes the server reload its configuration files. However, existing connections are terminated immediately. If the server isn’t running, this command will try to start it.apachectl stopThis shuts the server down immediately. Any existing connections are terminated at once.
For Windows, the MSI installation of Apache includes menu items for controlling the server, as shown in Figure 1-13.
Figure 1-13. Using the Start menu to control Apache
Both of the solutions shown (for ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access