Apache MPM Common Directives
See usage for the default setting
directory, which should not be writable by the user the server runs as.ServerRoot
If you want a core dump for debugging, you can use this directive to place it in a different location. This directive has no effect if your operating system is not configured to write core files to the working directory of the crashing processes.
If Apache httpd starts as root and switches to another user, the Linux kernel disables core dumps even if the directory is writable for the process. Apache httpd (2.0.46 and later) reenables core dumps on Linux 2.4 and beyond, but only if you explicitly configure a CoreDumpDirectory
To enable core-dumping of suid-executables on BSD-systems (such as FreeBSD), set kern.sugid_coredump
processing only occurs for a select set of fatal signals: SIGFPE, SIGILL, SIGABORT, SIGSEGV, and SIGBUS.
On some operating systems, SIGQUIT also results in a core dump but does not go through CoreDumpDirectory
There are already two modules, mod_whatkilledus
that make use of this hook. Please have a look at Jeff Trawick's EnableExceptionHook site for more information about these.
Setting this value to zero means that the server will wait indefinitely until all remaining requests have been fully served.
Listen [IP-address:]portnumber [protocol]
directive tells the server to accept incoming requests on the specified port or address-and-port combination. If only a port number is specified, the server listens to the given port on all interfaces. If an IP address is given as well as a port, the server will listen on the given port and interface.
directives may be used to specify a number of addresses and ports to listen to. The server will respond to requests from any of the listed addresses and ports.
For example, to make the server accept connections on both port 80 and port 8000, use:
Listen 192.170.2.1:80 Listen 192.170.2.5:8000
IPv6 addresses must be surrounded in square brackets, as in the following example:
Listen [2001:db8::a00:20ff:fea7:ccea]:80
The optional protocol argument is not required for most configurations. If not specified, https
the default for all other ports. The protocol is used to determine which module should handle a request, and to apply protocol specific optimizations with the
You only need to set the protocol if you are running on non-standard ports. For example, running an https
directives for the same ip address and port will result in an Address already in use
This will often be limited to a smaller number by the operating system. This varies from OS to OS. Also note that many OSes do not use exactly what is specified as the backlog, but use a number based on (but normally larger than) what is set.
is still supported.The MaxConnectionsPerChild
to a non-zero value limits the amount of memory that process can consume by (accidental) memory leakage.
translates into the maximum number of child processes that will be launched to serve requests. The default value is 256
For threaded and hybrid servers (e.g.
restricts the total number of threads that will be available to serve clients. For hybrid MPMs the default value is 16
) multiplied by the value of ServerLimit25
). Therefore, to increase ThreadsPerChildMaxRequestWorkers
to a value that requires more than 16 processes, you must also raise
, the default is workerMaxSpareThreads 250
. This MPM deals with idle threads on a server-wide basis. If there are too many idle threads in the server then child processes are killed until the number of idle threads is less than this number.
the default is mpm_netwareMaxSpareThreads 100
. Since this MPM runs a single-process, the spare thread count is also server-wide.
works similar to mpmt_os2
value is restricted. Apache httpd will correct the given value automatically according to the following rules:
wants the value to be greater than MinSpareThreads
and, since it is a single-process MPM, tracks this on a server-wide bases.
PidFile logs/httpd.pid
It is often useful to be able to send the server a signal, so that it closes and then re-opens its
, and re-reads its configuration files. This is done by sending a SIGHUP (kill -1) signal to the process id listed in the TransferLogPidFile
is subject to the same warnings about log file placement and security.
script, or the init script that your OS provides, for (re-)starting or stopping the server.apache2ctl
Apache HTTP Server uses a scoreboard to communicate between its parent and child processes. Some architectures require a file to facilitate this communication. If the file is left unspecified, Apache httpd first attempts to create the scoreboard entirely in memory (using anonymous shared memory) and, failing that, will attempt to create the file on disk (using file-based shared memory). Specifying this directive causes Apache httpd to always create the file on the disk.
ScoreBoardFile /var/run/apacheruntimestatus
File-based shared memory is useful for third-party applications that require direct access to the scoreboard.
then you may see improved speed by placing it on a RAM disk. But be careful that you heed the same warnings about log file placement and security.
Further configuration of your operating system may be required to elicit better performance on high speed, high latency connections.
On some operating systems, changes in TCP behavior resulting from a larger SendBufferSize
may not be seen unless
is set to OFF. This interaction applies only to static files.EnableSendfile
Special care must be taken when using this directive. If ServerLimit
is set to a value much higher than necessary, extra, unused shared memory will be allocated. If both ServerLimit
are set to values higher than the system can handle, Apache httpd may not start or the system may become unstable.MaxRequestWorkers
MPM 200000). This is intended to avoid nasty effects caused by typos. To increase it even further past this limit, you will need to modify the value of MAXSERVERLIMIT in the mpm source file and rebuild the server.prefork
defaults to workerStartServers 3
the default is mpm_netwareStartThreads 50
are set to values higher than the system can handle, Apache httpd may not start or the system may become unstable. Do not set the value of this directive any higher than your greatest predicted setting of ThreadsPerChild
) compiled into the server. This is intended to avoid nasty effects caused by typos. To increase it even further past this limit, you will need to modify the value of MAXTHREADLIMIT in the mpm source file and rebuild the server.mpm_winnt
, where there are multiple child processes, the workertotal number of threads should be high enough to handle the common load on the server.
to a value higher than the operating system default. This type of adjustment is necessary only if the provider of the third-party module specifies that it is required, or if diagnosis of an Apache httpd crash indicates that the thread stack size was too small.ThreadStackSize
is set to a value lower than the operating system default. This type of adjustment should only be made in a test environment which allows the full set of web server processing can be exercised, as there may be infrequent requests which require more stack to process. The minimum required stack size strongly depends on the modules used, but any change in the web server configuration can invalidate the current ThreadStackSize
unless a high number of threads per child process is needed. On some platforms (including Linux), a setting of 128000 is already too low and causes crashes with some common modules.
Modules | Directives | FAQ | Glossary | Sitemap
Apache HTTP Server Version 2.4
Apache MPM Common Directives
Available Languages: de | en | fr | ja | tr
CoreDumpDirectory Directive
This controls the directory to which Apache httpd attempts to switch before dumping core. If your operating system is configured to create core files in the working directory of the crashing process, CoreDumpDirectory is necessary to change working directory from the default ServerRoot directory, wh
EnableExceptionHook Directive
For safety reasons this directive is only available if the server was configured with the --enable-exception-hook option. It enables a hook that allows external modules to plug in and do something after a child crashed.
GracefulShutdownTimeout Directive
The GracefulShutdownTimeout specifies how many seconds after receiving a "graceful-stop" signal, a server should continue to run, handling the existing connections.
Listen Directive
The Listen directive instructs Apache httpd to listen to only specific IP addresses or ports; by default it responds to requests on all IP interfaces. Listen is now a required directive. If it is not in the config file, the server will fail to start. This is a change from previous versions of Apache
ListenBackLog Directive
The maximum length of the queue of pending connections. Generally no tuning is needed or desired, however on some systems it is desirable to increase this when under a TCP SYN flood attack. See the backlog parameter to the listen(2) system call.
MaxConnectionsPerChild Directive
The MaxConnectionsPerChild directive sets the limit on the number of connections that an individual child server process will handle. After MaxConnectionsPerChild connections, the child process will die. If MaxConnectionsPerChild is 0, then the process will never expire.
MaxMemFree Directive
The MaxMemFree directive sets the maximum number of free Kbytes that every allocator is allowed to hold without calling free(). In threaded MPMs, every thread has its own allocator. When set to zero, the threshold will be set to unlimited.
MaxRequestWorkers Directive
The MaxRequestWorkers directive sets the limit on the number of simultaneous requests that will be served. Any connection attempts over the MaxRequestWorkers limit will normally be queued, up to a number based on the ListenBacklog directive. Once a child process is freed at the end of a different re
MaxSpareThreads Directive
Maximum number of idle threads. Different MPMs deal with this directive differently.
MinSpareThreads Directive
Minimum number of idle threads to handle request spikes. Different MPMs deal with this directive differently.
PidFile Directive
The PidFile directive sets the file to which the server records the process id of the daemon. If the filename is not absolute then it is assumed to be relative to the ServerRoot.
ReceiveBufferSize Directive
The server will set the TCP receive buffer size to the number of bytes specified.
ScoreBoardFile Directive
Apache HTTP Server uses a scoreboard to communicate between its parent and child processes. Some architectures require a file to facilitate this communication. If the file is left unspecified, Apache httpd first attempts to create the scoreboard entirely in memory (using anonymous shared memory) and
SendBufferSize Directive
Sets the server's TCP send buffer size to the number of bytes specified. It is often useful to set this past the OS's standard default value on high speed, high latency connections (i.e., 100ms or so, such as transcontinental fast pipes).
ServerLimit Directive
For the prefork MPM, this directive sets the maximum configured value for MaxRequestWorkers for the lifetime of the Apache httpd process. For the worker MPM, this directive in combination with ThreadLimit sets the maximum configured value for MaxRequestWorkers for the lifetime of the Apache httpd pr
StartServers Directive
The StartServers directive sets the number of child server processes created on startup. As the number of processes is dynamically controlled depending on the load, (see MinSpareThreads, MaxSpareThreads, MinSpareServers, MaxSpareServers) there is usually little reason to adjust this parameter.
StartThreads Directive
Number of threads created on startup. As the number of threads is dynamically controlled depending on the load, (see MinSpareThreads, MaxSpareThreads, MinSpareServers, MaxSpareServers) there is usually little reason to adjust this parameter.
ThreadLimit Directive
This directive sets the maximum configured value for ThreadsPerChild for the lifetime of the Apache httpd process. Any attempts to change this directive during a restart will be ignored, but ThreadsPerChild can be modified during a restart up to the value of this directive.
ThreadsPerChild Directive
This directive sets the number of threads created by each child process. The child creates these threads at startup and never creates more. If using an MPM like mpm_winnt, where there is only one child process, this number should be high enough to handle the entire load of the server. If using an MP
ThreadStackSize Directive
The ThreadStackSize directive sets the size of the stack (for autodata) of threads which handle client connections and call modules to help process those connections. In most cases the operating system default for stack size is reasonable, but there are some conditions where it may need to be adjust