The Apache distribution includes several executables. This section covers only the server binary and related scripts. Chapter 25, "Restricting Access to Your Applications," and Chapter 29, "Apache Performance Tuning and Virtual Hosting," cover additional utilities included with the Apache distribution.
Apache Server Binary
The Apache executable is named httpd in Linux/UNIX and Mac OS X, and apache.exe in Windows. It accepts several command-line options, which are described in Table 3.1. You can get a complete listing of options by typing /usr/ local/apache2/bin/httpd -h on Linux/UNIX, by typing /usr/sbin/httpd -h on Mac OS X, or by typing apache.exe -h from a command prompt on Windows.
After Apache is running, you can use the kill command on Linux/UNIX and Mac OS X to send signals to the parent Apache process. Signals provide a mechanism to send commands to a process. To send a signal, execute the following command:
# kill -SIGNAL pid
In this syntax, pid is the process ID and SIGNAL is one of the following:
If you make some changes to the configuration files and you want them to take effect, you must signal Apache that the configuration has changed. You can do this by stopping and starting the server or by sending a restart signal. This tells Apache to reread its configuration.
A normal restart can result in a momentary pause in service. A graceful restart takes a different approach: Each thread or process serving a client will keep processing the current request, but when it is finished, it will be killed and replaced by a new thread or process with the new configuration. This allows seamless operation of the Web server with no downtime.
On Windows, you can signal Apache using the apache.exe executable:
You can access shortcuts to these commands in the Start menu entries that the Apache installer created. If you installed Apache as a service, you can start or stop Apache by using the Windows service interface: In Control Panel, select Administrative Tasks and then click the Services icon.
Apache Control Script
Although it is possible to control Apache on Linux/UNIX using the httpd binary, it is recommended that you use the apachectl tool. The apachectl support program wraps common functionality in an easy-to-use script. To use apachectl, type the following:
# /usr/local/apache2/bin/apachectl command
In this syntax, command can be stop, start, restart, or graceful. You can also edit the contents of the apachectl script to add extra command-line options.
Some OS distributions provide you with additional scripts to control Apache; please check the documentation included with your distribution.