mpm_common.html revision e3ec3193b69b45923c14915fa3ee3bc1f0215baf
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
1008001f34abb42df75f840db17f14a83f0c21d4Stephen Gallagher<TITLE>Apache MPM Common Directives</TITLE>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher<!-- Background white, links blue (unvisited), navy (visited), red (active) -->
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher BGCOLOR="#FFFFFF"
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher TEXT="#000000"
7a14e8f66c0e932fe2954d792614a3b61d444bd1Jakub Hrozek LINK="#0000FF"
7a14e8f66c0e932fe2954d792614a3b61d444bd1Jakub Hrozek VLINK="#000080"
7797e361155f7ce937085fd98e360469d7baf1b6Jakub Hrozek ALINK="#FF0000"
2ea6196484055397cc4bc011c5960f790431fa9dStephen Gallagher<!--#include virtual="header.html" -->
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher<H1 ALIGN="CENTER">Multi-Processing Module Common Directives</H1>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher<P>This file documents directives that are implemented by more
7a14e8f66c0e932fe2954d792614a3b61d444bd1Jakub Hrozekthan one multi-processing module (MPM).
65a9065538fd85e6ead925d344e6b421900eb8c2Jakub Hrozek<li><a href="#connectionstatus">ConnectionStatus</a></li>
65a9065538fd85e6ead925d344e6b421900eb8c2Jakub Hrozek<li><a href="#coredumpdirectory">CoreDumpDirectory</a></li>
2ea6196484055397cc4bc011c5960f790431fa9dStephen Gallagher<li><a href="#listenbacklog">ListenBacklog</a></li>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher<li><a href="#maxclients">MaxClients</a></li>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher<li><a href="#maxrequestsperchild">MaxRequestsPerChild</a></li>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher<li><a href="#maxsparethreads">MaxSpareThreads</a></li>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher<li><a href="#maxthreadsperchild">MaxThreadsPerChild</a></li>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher<li><a href="#minsparethreads">MinSpareThreads</a></li>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher<li><a href="#numservers">NumServers</a></li>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher<li><a href="#scoreboardfile">ScoreBoardFile</a></li>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher<li><a href="#sendbuffersize">SendBufferSize</a></li>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher<li><a href="#startservers">StartServers</a></li>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher<li><a href="#startthreads">StartThreads</a></li>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher<li><a href="#threadsperchild">ThreadsPerChild</a></li>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher<H2><A NAME="connectionstatus">ConnectionStatus directive</A></H2>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher ConnectionStatus on|off<BR>
1008001f34abb42df75f840db17f14a83f0c21d4Stephen Gallagher><STRONG>Context:</STRONG></A> server config<BR>
65a9065538fd85e6ead925d344e6b421900eb8c2Jakub Hrozek<p>Whether or not to maintain status information on current
2ea6196484055397cc4bc011c5960f790431fa9dStephen Gallagherconnections. If this is off then mod_status will not work properly.</p>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher<H2><A NAME="coredumpdirectory">CoreDumpDirectory directive</A></H2>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher<!--%plaintext <?INDEX {\tt CoreDumpDirectory} directive> -->
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher><STRONG>Syntax:</STRONG></A> CoreDumpDirectory <EM>directory</EM><BR>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher><STRONG>Default:</STRONG></A> the same location as ServerRoot<BR>
65a9065538fd85e6ead925d344e6b421900eb8c2Jakub Hrozek><STRONG>Context:</STRONG></A> server config<BR>
1008001f34abb42df75f840db17f14a83f0c21d4Stephen Gallagher><STRONG>Module:</STRONG></A> threaded, perchild, prefork, mpm_winnt</p>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher<p>This controls the directory to which Apache attempts to switch
1008001f34abb42df75f840db17f14a83f0c21d4Stephen Gallagherbefore dumping core. The default is in the <A
1008001f34abb42df75f840db17f14a83f0c21d4Stephen GallagherHREF="core.html#serverroot">ServerRoot</A> directory, however since
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagherthis should not be writable by the user the server runs as, core dumps
1008001f34abb42df75f840db17f14a83f0c21d4Stephen Gallagherwon't normally get written. If you want a core dump for debugging,
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagheryou can use this directive to place it in a different location.<P><HR>
1008001f34abb42df75f840db17f14a83f0c21d4Stephen Gallagher<H2><A NAME="group">Group directive</A></H2>
1008001f34abb42df75f840db17f14a83f0c21d4Stephen Gallagher<!--%plaintext <?INDEX {\tt Group} directive> -->
1008001f34abb42df75f840db17f14a83f0c21d4Stephen Gallagher><STRONG>Syntax:</STRONG></A> Group <EM>unix-group</EM><BR>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher><STRONG>Default:</STRONG></A> <CODE>Group #-1</CODE><BR>
1008001f34abb42df75f840db17f14a83f0c21d4Stephen Gallagher><STRONG>Context:</STRONG></A> server config, virtual host<BR>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher><STRONG>Module:</STRONG></A> threaded, perchild, prefork</p>
1008001f34abb42df75f840db17f14a83f0c21d4Stephen GallagherThe Group directive sets the group under which the server will answer requests.
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen GallagherIn order to use this directive, the stand-alone server must be run initially
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher<DT>A group name
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher<DD>Refers to the given group by name.
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher<DT># followed by a group number.
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher<DD>Refers to a group by its number.
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen GallagherIt is recommended that you set up a new group specifically for running the
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagherserver. Some admins use user <CODE>nobody</CODE>, but this is not always
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagherpossible or desirable.<P>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen GallagherNote: if you start the server as a non-root user, it will fail to change
65a9065538fd85e6ead925d344e6b421900eb8c2Jakub Hrozekto the specified group, and will instead continue to run as the group of the
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagheroriginal user. <P>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen GallagherSpecial note: Use of this directive in <VirtualHost> requires a
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagherproperly configured <A HREF="/suexec.html">suEXEC wrapper</A>.
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen GallagherWhen used inside a <VirtualHost> in this manner, only the group
65a9065538fd85e6ead925d344e6b421900eb8c2Jakub Hrozekthat CGIs are run as is affected. Non-CGI requests are still processed
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagheras the group specified in the main Group directive.<P>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen GallagherSECURITY: See <A HREF="#user">User</A> for a discussion of the security
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher<H2><A NAME="pidfile">PidFile directive</A></H2>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher<!--%plaintext <?INDEX {\tt PidFile} directive> -->
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher><STRONG>Syntax:</STRONG></A> PidFile <EM>filename</EM><BR>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher><STRONG>Default:</STRONG></A> <CODE>PidFile logs/httpd.pid</CODE><BR>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher><STRONG>Context:</STRONG></A> server config<BR>
1008001f34abb42df75f840db17f14a83f0c21d4Stephen Gallagher><STRONG>Module:</STRONG></A> threaded, perchild, prefork, mpm_winnt</p>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher<p>The PidFile directive sets the file to which the server records the
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagherprocess id of the daemon. If the filename does not begin with a slash
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher(/) then it is assumed to be relative to the <A
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen GallagherHREF="core.html#serverroot">ServerRoot</A>.</p>
1008001f34abb42df75f840db17f14a83f0c21d4Stephen Gallagher<p>It is often useful to be able to send the server a signal, so that
1008001f34abb42df75f840db17f14a83f0c21d4Stephen Gallagherit closes and then reopens its <A
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen GallagherHREF="core.html#errorlog">ErrorLog</A> and TransferLog, and re-reads
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagherits configuration files. This is done by sending a SIGHUP (kill -1)
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallaghersignal to the process id listed in the PidFile.</p>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher<p>The PidFile is subject to the same warnings about log file placement and
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher<A HREF="/misc/security_tips.html#serverroot">security</A>.</p>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher<H2><A NAME="listen">Listen directive</A></H2>
dd3ba5c5b7d2a9d109963ae9e6c94fff34872221Stephen GallagherListen [<EM>IP-address</EM>:]<EM>port number</EM><BR>
dd3ba5c5b7d2a9d109963ae9e6c94fff34872221Stephen Gallagher><STRONG>Context:</STRONG></A> server config<BR>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher><STRONG>Module:</STRONG></A> threaded, perchild, prefork, mpm_winnt</p>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher<P>The Listen directive instructs Apache to listen to only specific IP
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagheraddresses or ports; by default it responds to requests on all IP
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagherinterfaces, but only on the port given by the <CODE><A
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen GallagherHREF="core.html#port">Port</A></CODE> directive.</P>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher<p>The Listen directive tells
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagherthe server to accept incoming requests on the specified port or
dd3ba5c5b7d2a9d109963ae9e6c94fff34872221Stephen Gallagheraddress-and-port combination. If only a port number is specified,
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagherthe server listens to the given port on all interfaces,
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagherinstead of the port given by the <TT>Port</TT> directive. If an IP
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagheraddress is given as well as a port, the server will listen on the
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallaghergiven port and interface. <P>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen GallagherNote that you may still require a <TT>Port</TT> directive so
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagherthat URLs that Apache generates that point to your server still
7a14e8f66c0e932fe2954d792614a3b61d444bd1Jakub HrozekMultiple Listen directives may be used
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagherto specify a number of addresses and ports to listen to. The server
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagherwill respond to requests from any of the listed addresses and
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen GallagherFor example, to make the server accept connections on both port
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher80 and port 8000, use:
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen GallagherTo make the server accept connections on two specified
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagherinterfaces and port numbers, use
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher Listen 192.170.2.1:80
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher Listen 192.170.2.5:8000
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher<A HREF="/dns-caveats.html">DNS Issues</A><BR>
1008001f34abb42df75f840db17f14a83f0c21d4Stephen Gallagher<A HREF="/bind.html">Setting which addresses and ports Apache uses</A><BR>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher<A HREF="http://www.apache.org/info/known_bugs.html#listenbug">Known Bugs</A>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher<H2><A NAME="listenbacklog">ListenBacklog directive</A></H2>
e59e09b5010f262228bbdeb92a79b733bf5854b3Stephen Gallagher><STRONG>Syntax:</STRONG></A> ListenBacklog <EM>backlog</EM><BR>
056302a92862fda16351d7192600746746f38e5dStephen Gallagher><STRONG>Default:</STRONG></A> <CODE>ListenBacklog 511</CODE><BR>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher><STRONG>Context:</STRONG></A> server config<BR>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher><STRONG>Module:</STRONG></A> threaded, perchild, prefork, mpm_winnt</p>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher<P>The maximum length of the queue of pending connections. Generally no
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallaghertuning is needed or desired, however on some systems it is desirable
1008001f34abb42df75f840db17f14a83f0c21d4Stephen Gallagherto increase this when under a TCP SYN flood attack. See
dd3ba5c5b7d2a9d109963ae9e6c94fff34872221Stephen Gallagherthe backlog parameter to the <CODE>listen(2)</CODE> system call.
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher<P>This will often be limited to a smaller number by the operating
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallaghersystem. This varies from OS to OS. Also note that many OSes do not
1008001f34abb42df75f840db17f14a83f0c21d4Stephen Gallagheruse exactly what is specified as the backlog, but use a number based on
dd3ba5c5b7d2a9d109963ae9e6c94fff34872221Stephen Gallagher(but normally larger than) what is set.
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher<H2><A NAME="lockfile">LockFile directive</A></H2>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher><STRONG>Syntax:</STRONG></A> LockFile <EM>filename</EM><BR>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher><STRONG>Default:</STRONG></A> <CODE>LockFile logs/accept.lock</CODE><BR>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher><STRONG>Context:</STRONG></A> server config<BR>
dd3ba5c5b7d2a9d109963ae9e6c94fff34872221Stephen Gallagher><STRONG>Module:</STRONG></A> threaded, perchild, prefork</p>
dd3ba5c5b7d2a9d109963ae9e6c94fff34872221Stephen Gallagher<p>The LockFile directive sets the path to the lockfile used when
dd3ba5c5b7d2a9d109963ae9e6c94fff34872221Stephen GallagherApache is compiled with either USE_FCNTL_SERIALIZED_ACCEPT or
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen GallagherUSE_FLOCK_SERIALIZED_ACCEPT. This directive should normally be
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagherleft at its default value. The main reason for changing it is if
1008001f34abb42df75f840db17f14a83f0c21d4Stephen Gallagherthe <CODE>logs</CODE> directory is NFS mounted, since <STRONG>the lockfile
dd3ba5c5b7d2a9d109963ae9e6c94fff34872221Stephen Gallaghermust be stored on a local disk</STRONG>. The PID of the main
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagherserver process is automatically appended to the filename. <P>
dd3ba5c5b7d2a9d109963ae9e6c94fff34872221Stephen Gallagher<p><STRONG>SECURITY:</STRONG> It is best to avoid putting this file in a
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagherworld writable directory such as <CODE>/var/tmp</CODE> because someone
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallaghercould create a denial of service attack and prevent the server from
dd3ba5c5b7d2a9d109963ae9e6c94fff34872221Stephen Gallagherstarting by creating a lockfile with the same name as the one the
7a14e8f66c0e932fe2954d792614a3b61d444bd1Jakub Hrozekserver will try to create.</p>
1008001f34abb42df75f840db17f14a83f0c21d4Stephen Gallagher<H2><A NAME="maxclients">MaxClients directive</A></H2>
dd3ba5c5b7d2a9d109963ae9e6c94fff34872221Stephen Gallagher<!--%plaintext <?INDEX {\tt MaxClients} directive> -->
dd3ba5c5b7d2a9d109963ae9e6c94fff34872221Stephen Gallagher><STRONG>Syntax:</STRONG></A> MaxClients <EM>number</EM><BR>
dd3ba5c5b7d2a9d109963ae9e6c94fff34872221Stephen Gallagher><STRONG>Default:</STRONG></A> <CODE>MaxClients 8</code> (with threads)
dd3ba5c5b7d2a9d109963ae9e6c94fff34872221Stephen Gallagher<code>MaxClients 256</code> (no threads)<BR>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher><STRONG>Context:</STRONG></A> server config<BR>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher><STRONG>Module:</STRONG></A> threaded, prefork</p>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher<P>The MaxClients directive sets the limit on the number of child
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagherprocesses that will be created to serve requests. When the server is
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagherbuilt without threading, no more than this number of clients can be
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagherserved simultaneously. To configure more than 256 clients, you must
1008001f34abb42df75f840db17f14a83f0c21d4Stephen Gallagheredit the <code>HARD_SERVER_LIMIT</code> entry in
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher<P>Any connection attempts over the MaxClients limit will normally
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagherbe queued, up to a number based on the <A HREF="#listenbacklog">
1008001f34abb42df75f840db17f14a83f0c21d4Stephen GallagherListenBacklog</A> directive. Once a child process is freed at the
dd3ba5c5b7d2a9d109963ae9e6c94fff34872221Stephen Gallagherend of a different request, the connection will then be serviced.</p>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher<p>When the server is compiled with threading, then the maximum number
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagherof simultaneous requests that can be served is obtained from the value
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagherof this directive multiplied by <a
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagherhref="#threadsperchild">ThreadsPerChild</a>.</p>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher<H2><A NAME="maxrequestsperchild">MaxRequestsPerChild directive</A></H2>
1008001f34abb42df75f840db17f14a83f0c21d4Stephen Gallagher<!--%plaintext <?INDEX {\tt MaxRequestsPerChild} directive> -->
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher><STRONG>Syntax:</STRONG></A> MaxRequestsPerChild <EM>number</EM><BR>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher><STRONG>Default:</STRONG></A> <CODE>MaxRequestsPerChild 10000</CODE><BR>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher><STRONG>Context:</STRONG></A> server config<BR>
dd3ba5c5b7d2a9d109963ae9e6c94fff34872221Stephen Gallagher><STRONG>Module:</STRONG></A> threaded, prefork, perchild, mpm_winnt</p>
b355dcb54194f498921743ca33304eac35d89718Stephen Gallagher<p>The MaxRequestsPerChild directive sets the limit on the number of requests
52261fe16203dec6e6f69177c6d0a810b47d073fStephen Gallagherthat an individual child server process will handle. After MaxRequestsPerChild
52261fe16203dec6e6f69177c6d0a810b47d073fStephen Gallagherrequests, the child process will die. If MaxRequestsPerChild is 0, then
dd3ba5c5b7d2a9d109963ae9e6c94fff34872221Stephen Gallagherthe process will never expire.<P>
52261fe16203dec6e6f69177c6d0a810b47d073fStephen GallagherSetting MaxRequestsPerChild to a non-zero limit has two beneficial effects:
52261fe16203dec6e6f69177c6d0a810b47d073fStephen Gallagher<LI>it limits the amount of memory that process can consume by (accidental)
b355dcb54194f498921743ca33304eac35d89718Stephen Gallaghermemory leakage;
b355dcb54194f498921743ca33304eac35d89718Stephen Gallagher<LI> by giving processes a finite lifetime, it helps reduce the
52261fe16203dec6e6f69177c6d0a810b47d073fStephen Gallaghernumber of processes when the server load reduces.
52261fe16203dec6e6f69177c6d0a810b47d073fStephen Gallagher<P><STRONG>NOTE:</STRONG> For <EM>KeepAlive</EM> requests, only the first
52261fe16203dec6e6f69177c6d0a810b47d073fStephen Gallagherrequest is counted towards this limit. In effect, it changes the
52261fe16203dec6e6f69177c6d0a810b47d073fStephen Gallagherbehavior to limit the number of <EM>connections</EM> per child.
52261fe16203dec6e6f69177c6d0a810b47d073fStephen Gallagher<H2><A NAME="maxsparethreads">MaxSpareThreads directive</A></H2>
52261fe16203dec6e6f69177c6d0a810b47d073fStephen Gallagher><STRONG>Syntax:</STRONG></A> MaxSpareThreads <EM>number</EM><BR>
486237ee009f1d84fc4c85665dce80ade76f7079Stephen Gallagher><STRONG>Default:</STRONG></A> <CODE>MaxSpareThreads 10 (Perchild) or 500 (threaded) </CODE><BR>
e59e09b5010f262228bbdeb92a79b733bf5854b3Stephen Gallagher><STRONG>Context:</STRONG></A> server config<BR>
e59e09b5010f262228bbdeb92a79b733bf5854b3Stephen Gallagher><STRONG>Module:</STRONG></A> threaded, perchild</p>
7a14e8f66c0e932fe2954d792614a3b61d444bd1Jakub Hrozek<P>Maximum number of idle threads. Different MPMs deal with this directive
e59e09b5010f262228bbdeb92a79b733bf5854b3Stephen Gallagherdifferently. Perchild monitor the number of idle threads on a
e59e09b5010f262228bbdeb92a79b733bf5854b3Stephen Gallagherper-child basis. If there are too many idle threads in that child, the server
e59e09b5010f262228bbdeb92a79b733bf5854b3Stephen Gallagherwill begin to kill threads within that child.</P>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher<P>threaded deals with idle threads on a server-wide basis. If there are
dd3ba5c5b7d2a9d109963ae9e6c94fff34872221Stephen Gallaghertoo many idle threads in the server then child processes are killed
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagheruntil the number of idle threads is less than this number.</p>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher<p>See also <A HREF="#minsparethreads">MinSpareThreads</A> and
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher<H2><A NAME="maxthreadsperchild">MaxThreadsPerChild directive</A></H2>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher><STRONG>Syntax:</STRONG></A> MaxThreadsPerChild <EM>number</EM><BR>
dd3ba5c5b7d2a9d109963ae9e6c94fff34872221Stephen Gallagher><STRONG>Default:</STRONG></A> <CODE>MaxThreadsPerChild 64</code>
1008001f34abb42df75f840db17f14a83f0c21d4Stephen Gallagher><STRONG>Context:</STRONG></A> server config<BR>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher><STRONG>Module:</STRONG></A> threaded, perchild</p>
dd3ba5c5b7d2a9d109963ae9e6c94fff34872221Stephen Gallagher<P>Maximum number of threads per child. For MPMs with a variable
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallaghernumber of threads per child, this directive sets the maximum number of
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagherthreads that will be created in each child process. To increase this
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallaghervalue beyond its default, it is necessary to to change the value of
1008001f34abb42df75f840db17f14a83f0c21d4Stephen Gallagherthe compile-time define <code>HARD_THREAD_LIMIT</code> and recompile
dd3ba5c5b7d2a9d109963ae9e6c94fff34872221Stephen Gallagherthe server.</p>
52261fe16203dec6e6f69177c6d0a810b47d073fStephen Gallagher<H2><A NAME="minsparethreads">MinSpareThreads directive</A></H2>
dd3ba5c5b7d2a9d109963ae9e6c94fff34872221Stephen Gallagher<!--%plaintext <?INDEX {\tt MinSpareServers} directive> -->
52261fe16203dec6e6f69177c6d0a810b47d073fStephen Gallagher><STRONG>Syntax:</STRONG></A> MinSpareServers <EM>number</EM><BR>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher><STRONG>Default:</STRONG></A> <CODE>MaxSpareThreads 5 (Perchild) or 250 (threaded) </CODE><BR>
7a14e8f66c0e932fe2954d792614a3b61d444bd1Jakub Hrozek><STRONG>Context:</STRONG></A> server config<BR>
b355dcb54194f498921743ca33304eac35d89718Stephen Gallagher><STRONG>Module:</STRONG></A> threaded, perchild</p>
52261fe16203dec6e6f69177c6d0a810b47d073fStephen Gallagher<P>Minimum number of idle threads to handle request spikes. Different MPMs
dd3ba5c5b7d2a9d109963ae9e6c94fff34872221Stephen Gallagherdeal with this directive differently. Perchild monitor the number
52261fe16203dec6e6f69177c6d0a810b47d073fStephen Gallagherof idle threads on a per-child basis. If there aren't enough idle threads in
b355dcb54194f498921743ca33304eac35d89718Stephen Gallagherthat child, the server will begin to create new threads within that child.
52261fe16203dec6e6f69177c6d0a810b47d073fStephen Gallagher<P>threaded deals with idle threads on a server-wide basis. If there
7a14e8f66c0e932fe2954d792614a3b61d444bd1Jakub Hrozekaren't enough idle threads in the server then child processes are created
7a14e8f66c0e932fe2954d792614a3b61d444bd1Jakub Hrozekuntil the number of idle threads is greater than number.</p>
64a424ec1b268427822c646f7781e26e56c197f6Jakub HrozekSee also <A HREF="#maxsparethreads">MaxSpareThreads</A> and
52261fe16203dec6e6f69177c6d0a810b47d073fStephen Gallagher<A HREF="#startservers">StartServers</A>.<P><HR>
52261fe16203dec6e6f69177c6d0a810b47d073fStephen Gallagher<H2><A NAME="numservers">NumServers directive</A></H2>
2ea6196484055397cc4bc011c5960f790431fa9dStephen Gallagher><STRONG>Syntax:</STRONG></A> NumServers <EM>number</EM><BR>
e59e09b5010f262228bbdeb92a79b733bf5854b3Stephen Gallagher><STRONG>Default:</STRONG></A> <CODE>NumServers 2</CODE><BR>
e59e09b5010f262228bbdeb92a79b733bf5854b3Stephen Gallagher><STRONG>Context:</STRONG></A> server config<BR>
1008001f34abb42df75f840db17f14a83f0c21d4Stephen Gallagher<p>Number of children alive at the same time. MPMs that use this directive
dd3ba5c5b7d2a9d109963ae9e6c94fff34872221Stephen Gallagherdo not dynamically create new child processes so this number should be
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagherlarge enough to handle the requests for the entire site.</p>
e59e09b5010f262228bbdeb92a79b733bf5854b3Stephen Gallagher<H2><A NAME="scoreboardfile">ScoreBoardFile directive</A></H2>
e59e09b5010f262228bbdeb92a79b733bf5854b3Stephen Gallagher<!--%plaintext <?INDEX {\tt ScoreBoardFile} directive> -->
dd3ba5c5b7d2a9d109963ae9e6c94fff34872221Stephen Gallagher><STRONG>Syntax:</STRONG></A> ScoreBoardFile <EM>filename</EM><BR>
dd3ba5c5b7d2a9d109963ae9e6c94fff34872221Stephen Gallagher><STRONG>Default:</STRONG></A> <CODE>ScoreBoardFile logs/apache_status</CODE>
dd3ba5c5b7d2a9d109963ae9e6c94fff34872221Stephen Gallagher><STRONG>Context:</STRONG></A> server config<BR>
dd3ba5c5b7d2a9d109963ae9e6c94fff34872221Stephen Gallagher HREF="directive-dict.html#Compatibility"
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher><STRONG>Module:</STRONG></A> threaded, perchild, prefork</p>
dd3ba5c5b7d2a9d109963ae9e6c94fff34872221Stephen Gallagher<p>The ScoreBoardFile directive is required on some architectures to place
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallaghera file that the server will use to communicate between its children and
1008001f34abb42df75f840db17f14a83f0c21d4Stephen Gallagherthe parent. The easiest way to find out if your architecture requires
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallaghera scoreboard file is to run Apache and see if it creates the file named
1008001f34abb42df75f840db17f14a83f0c21d4Stephen Gallagherby the directive. If your architecture requires it then you must ensure
1008001f34abb42df75f840db17f14a83f0c21d4Stephen Gallagherthat this file is not used at the same time by more than one invocation
dd3ba5c5b7d2a9d109963ae9e6c94fff34872221Stephen Gallagher<p>If you have to use a ScoreBoardFile then you may see improved speed by
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagherplacing it on a RAM disk. But be careful that you heed the same warnings
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagherabout log file placement and
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher<A HREF="/misc/security_tips.html">security</A>.</p>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher<A HREF="/stopping.html">Stopping and Restarting Apache</A></P>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher<H2><A NAME="sendbuffersize">SendBufferSize directive</A></H2>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher<!--%plaintext <?INDEX {\tt SendBufferSize} directive> -->
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher><STRONG>Syntax:</STRONG></A> SendBufferSize <EM>bytes</EM><BR>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher><STRONG>Context:</STRONG></A> server config<BR>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher><STRONG>Module:</STRONG></A> threaded, perchild, prefork, mpm_winnt</p>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen GallagherThe server will set the TCP buffer size to the number of bytes
1008001f34abb42df75f840db17f14a83f0c21d4Stephen Gallagherspecified. Very useful to increase past standard OS defaults on high
dd3ba5c5b7d2a9d109963ae9e6c94fff34872221Stephen Gallagherspeed high latency (<EM>i.e.</EM>, 100ms or so, such as transcontinental
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher<H2><A NAME="startservers">StartServers directive</A></H2>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher<!--%plaintext <?INDEX {\tt StartServers} directive> -->
dd3ba5c5b7d2a9d109963ae9e6c94fff34872221Stephen Gallagher><STRONG>Syntax:</STRONG></A> StartServers <EM>number</EM><BR>
1008001f34abb42df75f840db17f14a83f0c21d4Stephen Gallagher><STRONG>Default:</STRONG></A> <CODE>StartServers 5</CODE><BR>
52261fe16203dec6e6f69177c6d0a810b47d073fStephen Gallagher><STRONG>Context:</STRONG></A> server config<BR>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher><STRONG>Module:</STRONG></A> threaded, prefork</p>
1008001f34abb42df75f840db17f14a83f0c21d4Stephen Gallagher<p>The StartServers directive sets the number of child server processes created
dd3ba5c5b7d2a9d109963ae9e6c94fff34872221Stephen Gallagheron startup. As the number of processes is dynamically controlled depending
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagheron the load, there is usually little reason to adjust this parameter.</P>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher<P>See also <A HREF="#minsparethreads">MinSpareThreads</A> and
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher<A HREF="#maxsparethreads">MaxSpareThreads</A>.<P><HR>
1008001f34abb42df75f840db17f14a83f0c21d4Stephen Gallagher<H2><A NAME="startthreads">StartThreads directive</A></H2>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher><STRONG>Syntax:</STRONG></A> StartThreads <EM>number</EM><BR>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher><STRONG>Default:</STRONG></A> <CODE>StartThreads 5</CODE><BR>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher><STRONG>Context:</STRONG></A> server config<BR>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher<p>Number of threads each child creates on startup. As the number of threads
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagheris dynamically controlled depending on the load, there is usually little
1008001f34abb42df75f840db17f14a83f0c21d4Stephen Gallagherreason to adjust this parameter.</p>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher<H2><A NAME="threadsperchild">ThreadsPerChild</A></H2>
6b0f9cd2ee601121cb7fe1d9ad8ebce782aa8f39Stephen Gallagher><STRONG>Syntax:</STRONG></A> ThreadsPerChild <EM>number</EM><BR>
65a9065538fd85e6ead925d344e6b421900eb8c2Jakub Hrozek><STRONG>Default:</STRONG></A> <CODE>ThreadsPerChild 50</CODE><BR>
9643e7da1a54a9edb2360ab8f855664a8b4397caStephen Gallagher><STRONG>Context:</STRONG></A> server config<BR>
9643e7da1a54a9edb2360ab8f855664a8b4397caStephen Gallagher><STRONG>Module:</STRONG></A> threaded, mpm_winnt</p>
9643e7da1a54a9edb2360ab8f855664a8b4397caStephen Gallagher<P>This directive sets the number of threads created by each child
65a9065538fd85e6ead925d344e6b421900eb8c2Jakub Hrozekprocess. The child creates these threads at startup and never creates
9643e7da1a54a9edb2360ab8f855664a8b4397caStephen Gallaghermore. if using an MPM like mpmt_winnt, where there is only one child process,
9643e7da1a54a9edb2360ab8f855664a8b4397caStephen Gallagherthis number should be high enough to handle the entire load of the server.
9643e7da1a54a9edb2360ab8f855664a8b4397caStephen GallagherIf using an MPM like threaded, where there are multiple child processes,
65a9065538fd85e6ead925d344e6b421900eb8c2Jakub Hrozekthe total number of threads should be high enough to handle the common load
65a9065538fd85e6ead925d344e6b421900eb8c2Jakub Hrozekon the server.</p>
9643e7da1a54a9edb2360ab8f855664a8b4397caStephen Gallagher<!--%plaintext <?INDEX {\tt User} directive> -->
65a9065538fd85e6ead925d344e6b421900eb8c2Jakub Hrozek><STRONG>Syntax:</STRONG></A> User <EM>unix-userid</EM><BR>
65a9065538fd85e6ead925d344e6b421900eb8c2Jakub Hrozek><STRONG>Default:</STRONG></A> <CODE>User #-1</CODE><BR>
9643e7da1a54a9edb2360ab8f855664a8b4397caStephen Gallagher><STRONG>Context:</STRONG></A> server config, virtual host<BR>
9643e7da1a54a9edb2360ab8f855664a8b4397caStephen Gallagher><STRONG>Module:</STRONG></A> threaded, perchild, prefork</p>
9643e7da1a54a9edb2360ab8f855664a8b4397caStephen GallagherThe User directive sets the userid as which the server will answer requests.
9643e7da1a54a9edb2360ab8f855664a8b4397caStephen GallagherIn order to use this directive, the standalone server must be run initially
9643e7da1a54a9edb2360ab8f855664a8b4397caStephen Gallagher<DD>Refers to the given user by name.
65a9065538fd85e6ead925d344e6b421900eb8c2Jakub Hrozek<DT># followed by a user number.
65a9065538fd85e6ead925d344e6b421900eb8c2Jakub Hrozek<DD>Refers to a user by their number.
9643e7da1a54a9edb2360ab8f855664a8b4397caStephen GallagherThe user should have no privileges which result in it being able to access
9643e7da1a54a9edb2360ab8f855664a8b4397caStephen Gallagherfiles which are not intended to be visible to the outside world, and
9643e7da1a54a9edb2360ab8f855664a8b4397caStephen Gallaghersimilarly, the user should not be able to execute code which is not
9643e7da1a54a9edb2360ab8f855664a8b4397caStephen Gallaghermeant for httpd requests. It is recommended that you set up a new user and
65a9065538fd85e6ead925d344e6b421900eb8c2Jakub Hrozekgroup specifically for running the server. Some admins use user
65a9065538fd85e6ead925d344e6b421900eb8c2Jakub Hrozek<CODE>nobody</CODE>, but this is not always possible or desirable.
9643e7da1a54a9edb2360ab8f855664a8b4397caStephen GallagherFor example mod_proxy's cache, when enabled, must be accessible to this user
9643e7da1a54a9edb2360ab8f855664a8b4397caStephen Gallagher(see the <A HREF="mod_proxy.html#cacheroot"><CODE>CacheRoot</CODE>
65a9065538fd85e6ead925d344e6b421900eb8c2Jakub HrozekNotes: If you start the server as a non-root user, it will fail to change
65a9065538fd85e6ead925d344e6b421900eb8c2Jakub Hrozekto the lesser privileged user, and will instead continue to run as
65a9065538fd85e6ead925d344e6b421900eb8c2Jakub Hrozekthat original user. If you do start the server as root, then it is normal
65a9065538fd85e6ead925d344e6b421900eb8c2Jakub Hrozekfor the parent process to remain running as root.<P>
65a9065538fd85e6ead925d344e6b421900eb8c2Jakub HrozekSpecial note: Use of this directive in <VirtualHost> requires a
65a9065538fd85e6ead925d344e6b421900eb8c2Jakub Hrozekproperly configured <A HREF="/suexec.html">suEXEC wrapper</A>.
65a9065538fd85e6ead925d344e6b421900eb8c2Jakub HrozekWhen used inside a <VirtualHost> in this manner, only the user
65a9065538fd85e6ead925d344e6b421900eb8c2Jakub Hrozekthat CGIs are run as is affected. Non-CGI requests are still processed
65a9065538fd85e6ead925d344e6b421900eb8c2Jakub Hrozekwith the user specified in the main User directive.<P>
65a9065538fd85e6ead925d344e6b421900eb8c2Jakub HrozekSECURITY: Don't set User (or <A HREF="#group">Group</A>) to
65a9065538fd85e6ead925d344e6b421900eb8c2Jakub Hrozek<CODE>root</CODE> unless you know exactly what you are doing, and what the
65a9065538fd85e6ead925d344e6b421900eb8c2Jakub Hrozekdangers are.<P>
65a9065538fd85e6ead925d344e6b421900eb8c2Jakub Hrozek<!--#include virtual="footer.html" -->