Apache HTTP Server Version 2.0
This document covers stopping and restarting Apache on Unix-like systems. Windows users should see Signalling Apache when running.
You will notice many httpd
executables running on
your system, but you should not send signals to any of them except
the parent, whose pid is in the PidFile
. That is to say you shouldn't ever
need to send signals to any process except the parent. There are
three signals that you can send the parent: TERM
,
HUP
, and USR1
, which will be described
in a moment.
To send a signal to the parent you should issue a command such as:
kill -TERM `cat /usr/local/apache/logs/httpd.pid`
You can read about its progress by issuing:
tail -f /usr/local/apache/logs/error_log
Modify those examples to match your ServerRoot
and PidFile
settings.
A shell script called apachectl is provided which automates the processing of signalling Apache. For details about this script, see the documentation on starting Apache.
apachectl stop
Sending the TERM
signal to the parent causes it
to immediately attempt to kill off all of its children. It may
take it several seconds to complete killing off its children.
Then the parent itself exits. Any requests in progress are
terminated, and no further requests are served.
apachectl graceful
The USR1
signal causes the parent process to
advise the children to exit after their current
request (or to exit immediately if they're not serving
anything). The parent re-reads its configuration files and
re-opens its log files. As each child dies off the parent
replaces it with a child from the new generation of
the configuration, which begins serving new requests
immediately.
apachectl graceful
will send the
right signal for your platform.This code is designed to always respect the process control
directive of the MPMs, so the number of processes and threads
available to serve clients will be maintained at the appropriate
values throughout the restart process. Furthermore, it respects
StartServers
in the
following manner: if after one second at least StartServers
new children have not
been created, then create enough to pick up the slack. Hence the
code tries to maintain both the number of children appropriate for
the current load on the server, and respect your wishes with the
StartServers parameter.
Users of the mod_status
will notice that the server statistics are not
set to zero when a USR1
is sent. The code was
written to both minimize the time in which the server is unable
to serve new requests (they will be queued up by the operating
system, so they're not lost in any event) and to respect your
tuning parameters. In order to do this it has to keep the
scoreboard used to keep track of all children across
generations.
The status module will also use a G
to indicate
those children which are still serving requests started before
the graceful restart was given.
At present there is no way for a log rotation script using
USR1
to know for certain that all children writing
the pre-restart log have finished. We suggest that you use a
suitable delay after sending the USR1
signal
before you do anything with the old log. For example if most of
your hits take less than 10 minutes to complete for users on
low bandwidth links then you could wait 15 minutes before doing
anything with the old log.
-t
command line argument (see httpd). This still will not
guarantee that the server will restart correctly. To check the
semantics of the configuration files as well as the syntax, you
can try starting httpd as a non-root user. If there are no
errors it will attempt to open its sockets and logs and fail
because it's not root (or because the cuHTTP/1.1 200 OK
Date: Mon, 07 Jul 2025 05:55:12 GMT
Server: Apache/2.0.42 (Win32) PHP/5.2.10
Content-Location: stopping.html.en
Vary: negotiate,accept-language,accept-charset
TCN: choice
Accept-Ranges: bytes
Content-Length: 12256
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=ISO-8859-1
Content-Language: en
Apache HTTP Server Version 2.0
This document covers stopping and restarting Apache on Unix-like systems. Windows users should see Signalling Apache when running.
You will notice many httpd
executables running on
your system, but you should not send signals to any of them except
the parent, whose pid is in the PidFile
. That is to say you shouldn't ever
need to send signals to any process except the parent. There are
three signals that you can send the parent: TERM
,
HUP
, and USR1
, which will be described
in a moment.
To send a signal to the parent you should issue a command such as:
kill -TERM `cat /usr/local/apache/logs/httpd.pid`
You can read about its progress by issuing:
tail -f /usr/local/apache/logs/error_log