1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
4 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
5 This file is generated from xml source: DO NOT EDIT
6 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
8 <title>mpm_common - Apache HTTP Server</title>
9 <link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
10 <link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
11 <link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
12 <link href="../images/favicon.ico" rel="shortcut icon" /></head>
14 <div id="page-header">
15 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p>
16 <p class="apache">Apache HTTP Server Version 2.0</p>
17 <img alt="" src="../images/feather.gif" /></div>
18 <div class="up"><a href="./"><img title="<-" alt="<-" src="../images/left.gif" /></a></div>
20 <a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs/">Documentation</a> > <a href="../">Version 2.0</a> > <a href="./">Modules</a></div>
21 <div id="page-content">
22 <div id="preamble"><h1>Apache MPM Common Directives</h1>
24 <p><span>Available Languages: </span><a href="../de/mod/mpm_common.html" hreflang="de" rel="alternate" title="Deutsch"> de </a> |
25 <a href="../en/mod/mpm_common.html" title="English"> en </a> |
26 <a href="../es/mod/mpm_common.html" hreflang="es" rel="alternate" title="Español"> es </a> |
27 <a href="../ja/mod/mpm_common.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
28 <a href="../tr/mod/mpm_common.html" hreflang="tr" rel="alternate" title="Türkçe"> tr </a></p>
30 <table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>A collection of directives that are implemented by
31 more than one multi-processing module (MPM)</td></tr>
32 <tr><th><a href="module-dict.html#Status">Status:</a></th><td>MPM</td></tr></table>
34 <div id="quickview"><h3 class="directives">Directives</h3>
36 <li><img alt="" src="../images/down.gif" /> <a href="#acceptmutex">AcceptMutex</a></li>
37 <li><img alt="" src="../images/down.gif" /> <a href="#bs2000account">BS2000Account</a></li>
38 <li><img alt="" src="../images/down.gif" /> <a href="#coredumpdirectory">CoreDumpDirectory</a></li>
39 <li><img alt="" src="../images/down.gif" /> <a href="#enableexceptionhook">EnableExceptionHook</a></li>
40 <li><img alt="" src="../images/down.gif" /> <a href="#group">Group</a></li>
41 <li><img alt="" src="../images/down.gif" /> <a href="#listen">Listen</a></li>
42 <li><img alt="" src="../images/down.gif" /> <a href="#listenbacklog">ListenBackLog</a></li>
43 <li><img alt="" src="../images/down.gif" /> <a href="#lockfile">LockFile</a></li>
44 <li><img alt="" src="../images/down.gif" /> <a href="#maxclients">MaxClients</a></li>
45 <li><img alt="" src="../images/down.gif" /> <a href="#maxmemfree">MaxMemFree</a></li>
46 <li><img alt="" src="../images/down.gif" /> <a href="#maxrequestsperchild">MaxRequestsPerChild</a></li>
47 <li><img alt="" src="../images/down.gif" /> <a href="#maxsparethreads">MaxSpareThreads</a></li>
48 <li><img alt="" src="../images/down.gif" /> <a href="#minsparethreads">MinSpareThreads</a></li>
49 <li><img alt="" src="../images/down.gif" /> <a href="#pidfile">PidFile</a></li>
50 <li><img alt="" src="../images/down.gif" /> <a href="#receivebuffersize">ReceiveBufferSize</a></li>
51 <li><img alt="" src="../images/down.gif" /> <a href="#scoreboardfile">ScoreBoardFile</a></li>
52 <li><img alt="" src="../images/down.gif" /> <a href="#sendbuffersize">SendBufferSize</a></li>
53 <li><img alt="" src="../images/down.gif" /> <a href="#serverlimit">ServerLimit</a></li>
54 <li><img alt="" src="../images/down.gif" /> <a href="#startservers">StartServers</a></li>
55 <li><img alt="" src="../images/down.gif" /> <a href="#startthreads">StartThreads</a></li>
56 <li><img alt="" src="../images/down.gif" /> <a href="#threadlimit">ThreadLimit</a></li>
57 <li><img alt="" src="../images/down.gif" /> <a href="#threadsperchild">ThreadsPerChild</a></li>
58 <li><img alt="" src="../images/down.gif" /> <a href="#user">User</a></li>
62 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
63 <div class="directive-section"><h2><a name="AcceptMutex" id="AcceptMutex">AcceptMutex</a> <a name="acceptmutex" id="acceptmutex">Directive</a></h2>
64 <table class="directive">
65 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Method that Apache uses to serialize multiple children
66 accepting requests on network sockets</td></tr>
67 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AcceptMutex Default|<var>method</var></code></td></tr>
68 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AcceptMutex Default</code></td></tr>
69 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
70 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
71 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/leader.html">leader</a></code>, <code class="module"><a href="../mod/perchild.html">perchild</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/threadpool.html">threadpool</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
73 <p>The <code class="directive">AcceptMutex</code> directives sets the
74 method that Apache uses to serialize multiple children accepting
75 requests on network sockets. Prior to Apache 2.0, the method was
76 selectable only at compile time. The optimal method to use is
77 highly architecture and platform dependent. For further details,
78 see the <a href="../misc/perf-tuning.html">performance tuning</a>
81 <p>If this directive is set to <code>Default</code>, then the
82 compile-time selected default will be used. Other possible
83 methods are listed below. Note that not all methods are
84 available on all platforms. If a method is specified which is
85 not available, a message will be written to the error log
86 listing the available methods.</p>
89 <dt><code>flock</code></dt>
90 <dd>uses the <code>flock(2)</code> system call to lock the
91 file defined by the <code class="directive"><a href="#lockfile">LockFile</a></code> directive.</dd>
93 <dt><code>fcntl</code></dt>
94 <dd>uses the <code>fcntl(2)</code> system call to lock the
95 file defined by the <code class="directive"><a href="#lockfile">LockFile</a></code> directive.</dd>
97 <dt><code>posixsem</code></dt>
98 <dd>uses POSIX compatible semaphores to implement the mutex.</dd>
100 <dt><code>pthread</code></dt>
101 <dd>uses POSIX mutexes as implemented by the POSIX Threads
102 (PThreads) specification.</dd>
104 <dt><code>sysvsem</code></dt>
105 <dd>uses SySV-style semaphores to implement the mutex.</dd>
108 <p>If you want to find out the compile time chosen default
109 for your system, you may set your <code class="directive"><a href="../mod/core.html#loglevel">LogLevel</a></code> to <code>debug</code>. Then the default <code class="directive">AcceptMutex</code> will be written into the <code class="directive"><a href="../mod/core.html#errorlog">ErrorLog</a></code>.</p>
112 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
113 <div class="directive-section"><h2><a name="BS2000Account" id="BS2000Account">BS2000Account</a> <a name="bs2000account" id="bs2000account">Directive</a></h2>
114 <table class="directive">
115 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Define the non-privileged account on BS2000
117 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>BS2000Account <var>account</var></code></td></tr>
118 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
119 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
120 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/perchild.html">perchild</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code></td></tr>
121 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Only available for BS2000 machines</td></tr>
123 <p>The <code class="directive">BS2000Account</code> directive is available for
124 BS2000 hosts only. It must be used to define the account number for
125 the non-privileged apache server user (which was configured using the
126 <code class="directive"><a href="#user">User</a></code> directive). This is
127 required by the BS2000 POSIX subsystem (to change the underlying BS2000
128 task environment by performing a sub-LOGON) to prevent CGI scripts
129 from accessing resources of the privileged account which started the
130 server, usually <code>SYSROOT</code>.</p>
132 <div class="note"><h3>Note</h3>
133 <p>Only one <code>BS2000Account</code> directive can be used.</p>
138 <li><a href="../platform/ebcdic.html">Apache EBCDIC port</a></li>
141 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
142 <div class="directive-section"><h2><a name="CoreDumpDirectory" id="CoreDumpDirectory">CoreDumpDirectory</a> <a name="coredumpdirectory" id="coredumpdirectory">Directive</a></h2>
143 <table class="directive">
144 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Directory where Apache attempts to
145 switch before dumping core</td></tr>
146 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>CoreDumpDirectory <var>directory</var></code></td></tr>
147 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for the default setting</code></td></tr>
148 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
149 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
150 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/beos.html">beos</a></code>, <code class="module"><a href="../mod/leader.html">leader</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="../mod/perchild.html">perchild</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/threadpool.html">threadpool</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
152 <p>This controls the directory to which Apache attempts to
153 switch before dumping core. The default is in the
154 <code class="directive"><a href="../mod/core.html#serverroot">ServerRoot</a></code> directory, however
155 since this should not be writable by the user the server runs
156 as, core dumps won't normally get written. If you want a core
157 dump for debugging, you can use this directive to place it in a
158 different location.</p>
160 <div class="note"><h3>Core Dumps on Linux</h3>
161 <p>If Apache starts as root and switches to another user, the
162 Linux kernel <em>disables</em> core dumps even if the directory is
163 writable for the process. Apache (2.0.46 and later) reenables core dumps
164 on Linux 2.4 and beyond, but only if you explicitly configure a <code class="directive">CoreDumpDirectory</code>.</p>
168 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
169 <div class="directive-section"><h2><a name="EnableExceptionHook" id="EnableExceptionHook">EnableExceptionHook</a> <a name="enableexceptionhook" id="enableexceptionhook">Directive</a></h2>
170 <table class="directive">
171 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enables a hook that runs exception handlers
172 after a crash</td></tr>
173 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>EnableExceptionHook On|Off</code></td></tr>
174 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>EnableExceptionHook Off</code></td></tr>
175 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
176 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
177 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/leader.html">leader</a></code>, <code class="module"><a href="../mod/perchild.html">perchild</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/threadpool.html">threadpool</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
178 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in version 2.0.49 and later</td></tr>
180 <p>For safety reasons this directive is only available if the server was
181 configured with the <code>--enable-exception-hook</code> option. It
182 enables a hook that allows external modules to plug in and do something
183 after a child crashed.</p>
185 <p>There are already two modules, <code>mod_whatkilledus</code> and
186 <code>mod_backtrace</code> that make use of this hook. Please have a
187 look at Jeff Trawick's <a href="http://www.apache.org/~trawick/exception_hook.html">EnableExceptionHook site</a> for more information about these.</p>
190 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
191 <div class="directive-section"><h2><a name="Group" id="Group">Group</a> <a name="group" id="group">Directive</a></h2>
192 <table class="directive">
193 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Group under which the server will answer
195 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Group <var>unix-group</var></code></td></tr>
196 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>Group #-1</code></td></tr>
197 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
198 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
199 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/beos.html">beos</a></code>, <code class="module"><a href="../mod/leader.html">leader</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code>, <code class="module"><a href="../mod/perchild.html">perchild</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/threadpool.html">threadpool</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
200 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Only valid in global server config since Apache
203 <p>The <code class="directive">Group</code> directive sets the group under
204 which the server will answer requests. In order to use this
205 directive, the server must be run initially as <code>root</code>. If
206 you start the server as a non-root user, it will fail to change to the
207 specified group, and will instead continue to run as the group of the
208 original user. <var>Unix-group</var> is one of:</p>
211 <dt>A group name</dt>
212 <dd>Refers to the given group by name.</dd>
214 <dt><code>#</code> followed by a group number.</dt>
215 <dd>Refers to a group by its number.</dd>
218 <div class="example"><h3>Example</h3><p><code>
222 <p>It is recommended that you set up a new group specifically for
223 running the server. Some admins use user <code>nobody</code>,
224 but this is not always possible or desirable.</p>
226 <div class="warning"><h3>Security</h3>
227 <p>Don't set <code class="directive">Group</code> (or <code class="directive"><a href="#user">User</a></code>) to <code>root</code> unless
228 you know exactly what you are doing, and what the dangers are.</p>
231 <p>Special note: Use of this directive in <code class="directive"><a href="../mod/core.html#virtualhost"><VirtualHost></a></code> is no longer supported. To
232 configure your server for <code class="program"><a href="../programs/suexec.html">suexec</a></code> use
233 <code class="directive"><a href="../mod/mod_suexec.html#suexecusergroup">SuexecUserGroup</a></code>.</p>
235 <div class="note"><h3>Note</h3>
236 <p>Although the <code class="directive">Group</code> directive is present
237 in the <code class="module"><a href="../mod/beos.html">beos</a></code> and <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code> MPMs,
238 it is actually a no-op there and only exists for compatibility
243 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
244 <div class="directive-section"><h2><a name="Listen" id="Listen">Listen</a> <a name="listen" id="listen">Directive</a></h2>
245 <table class="directive">
246 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>IP addresses and ports that the server
248 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Listen [<var>IP-address</var>:]<var>portnumber</var></code></td></tr>
249 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
250 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
251 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/beos.html">beos</a></code>, <code class="module"><a href="../mod/leader.html">leader</a></code>, <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code>, <code class="module"><a href="../mod/perchild.html">perchild</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/threadpool.html">threadpool</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
252 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Required directive since Apache 2.0</td></tr>
254 <p>The <code class="directive">Listen</code> directive instructs Apache to
255 listen to only specific IP addresses or ports; by default it
256 responds to requests on all IP interfaces. <code class="directive">Listen</code>
257 is now a required directive. If it is not in the config file, the
258 server will fail to start. This is a change from previous versions
261 <p>The <code class="directive">Listen</code> directive tells the server to
262 accept incoming requests on the specified port or address-and-port
263 combination. If only a port number is specified, the server listens to
264 the given port on all interfaces. If an IP address is given as well
265 as a port, the server will listen on the given port and
268 <p>Multiple <code class="directive">Listen</code> directives may be used to
269 specify a number of addresses and ports to listen to. The server will
270 respond to requests from any of the listed addresses and ports.</p>
272 <p>For example, to make the server accept connections on both
273 port 80 and port 8000, use:</p>
275 <div class="example"><p><code>
280 <p>To make the server accept connections on two specified
281 interfaces and port numbers, use </p>
283 <div class="example"><p><code>
284 Listen 192.170.2.1:80<br />
285 Listen 192.170.2.5:8000
288 <p>IPv6 addresses must be surrounded in square brackets, as in the
289 following example:</p>
291 <div class="example"><p><code>
292 Listen [2001:db8::a00:20ff:fea7:ccea]:80
295 <div class="note"><h3>Error condition</h3>
296 Multiple <code class="directive">Listen</code> directives for the same ip
297 address and port will result in an <code>Address already in use</code>
303 <li><a href="../dns-caveats.html">DNS Issues</a></li>
304 <li><a href="../bind.html">Setting which addresses and ports Apache
308 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
309 <div class="directive-section"><h2><a name="ListenBackLog" id="ListenBackLog">ListenBackLog</a> <a name="listenbacklog" id="listenbacklog">Directive</a></h2>
310 <table class="directive">
311 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maximum length of the queue of pending connections</td></tr>
312 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ListenBacklog <var>backlog</var></code></td></tr>
313 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ListenBacklog 511</code></td></tr>
314 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
315 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
316 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/beos.html">beos</a></code>, <code class="module"><a href="../mod/leader.html">leader</a></code>, <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code>, <code class="module"><a href="../mod/perchild.html">perchild</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/threadpool.html">threadpool</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
318 <p>The maximum length of the queue of pending connections.
319 Generally no tuning is needed or desired, however on some
320 systems it is desirable to increase this when under a TCP SYN
321 flood attack. See the backlog parameter to the
322 <code>listen(2)</code> system call.</p>
324 <p>This will often be limited to a smaller number by the
325 operating system. This varies from OS to OS. Also note that
326 many OSes do not use exactly what is specified as the backlog,
327 but use a number based on (but normally larger than) what is
331 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
332 <div class="directive-section"><h2><a name="LockFile" id="LockFile">LockFile</a> <a name="lockfile" id="lockfile">Directive</a></h2>
333 <table class="directive">
334 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Location of the accept serialization lock file</td></tr>
335 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LockFile <var>filename</var></code></td></tr>
336 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LockFile logs/accept.lock</code></td></tr>
337 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
338 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
339 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/leader.html">leader</a></code>, <code class="module"><a href="../mod/perchild.html">perchild</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/threadpool.html">threadpool</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
341 <p>The <code class="directive">LockFile</code> directive sets the path to
342 the lockfile used when Apache is used with an <code class="directive"><a href="#acceptmutex">AcceptMutex</a></code> value of either
343 <code>fcntl</code> or <code>flock</code>. This directive should
344 normally be left at its default value. The main reason for changing
345 it is if the <code>logs</code> directory is NFS mounted, since
346 <strong>the lockfile must be stored on a local disk</strong>. The PID
347 of the main server process is automatically appended to the
350 <div class="warning"><h3>Security</h3>
351 <p>It is best to <em>avoid</em> putting this file in a world writable
352 directory such as <code>/var/tmp</code> because someone could create
353 a denial of service attack and prevent the server from starting by
354 creating a lockfile with the same name as the one the server will try
360 <li><code class="directive"><a href="#acceptmutex">AcceptMutex</a></code></li>
363 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
364 <div class="directive-section"><h2><a name="MaxClients" id="MaxClients">MaxClients</a> <a name="maxclients" id="maxclients">Directive</a></h2>
365 <table class="directive">
366 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maximum number of connections that will be processed
367 simultaneously</td></tr>
368 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MaxClients <var>number</var></code></td></tr>
369 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr>
370 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
371 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
372 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/beos.html">beos</a></code>, <code class="module"><a href="../mod/leader.html">leader</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/threadpool.html">threadpool</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
374 <p>The <code class="directive">MaxClients</code> directive sets the limit
375 on the number of simultaneous requests that will be served. Any
376 connection attempts over the <code class="directive">MaxClients</code>
377 limit will normally be queued, up to a number based on the
378 <code class="directive"><a href="#listenbacklog">ListenBacklog</a></code>
379 directive. Once a child process is freed at the end of a different
380 request, the connection will then be serviced.</p>
382 <p>For non-threaded servers (<em>i.e.</em>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>),
383 <code class="directive">MaxClients</code> translates into the maximum
384 number of child processes that will be launched to serve requests.
385 The default value is <code>256</code>; to increase it, you must also raise
386 <code class="directive"><a href="#serverlimit">ServerLimit</a></code>.</p>
388 <p>For threaded and hybrid servers (<em>e.g.</em> <code class="module"><a href="../mod/beos.html">beos</a></code>
389 or <code class="module"><a href="../mod/worker.html">worker</a></code>) <code class="directive">MaxClients</code> restricts
390 the total number of threads that will be available to serve clients.
391 The default value for <code class="module"><a href="../mod/beos.html">beos</a></code> is <code>50</code>. For
392 hybrid MPMs the default value is <code>16</code> (<code class="directive"><a href="#serverlimit">ServerLimit</a></code>) multiplied by the value of
393 <code>25</code> (<code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code>). Therefore, to increase <code class="directive">MaxClients</code> to a value that requires more than 16 processes,
394 you must also raise <code class="directive"><a href="#serverlimit">ServerLimit</a></code>.</p>
397 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
398 <div class="directive-section"><h2><a name="MaxMemFree" id="MaxMemFree">MaxMemFree</a> <a name="maxmemfree" id="maxmemfree">Directive</a></h2>
399 <table class="directive">
400 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maximum amount of memory that the main allocator is allowed
401 to hold without calling <code>free()</code></td></tr>
402 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MaxMemFree <var>KBytes</var></code></td></tr>
403 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MaxMemFree 0</code></td></tr>
404 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
405 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
406 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/beos.html">beos</a></code>, <code class="module"><a href="../mod/leader.html">leader</a></code>, <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/threadpool.html">threadpool</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code></td></tr>
408 <p>The <code class="directive">MaxMemFree</code> directive sets the
409 maximum number of free Kbytes that the main allocator is allowed
410 to hold without calling <code>free()</code>. When not set, or when set
411 to zero, the threshold will be set to unlimited.</p>
414 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
415 <div class="directive-section"><h2><a name="MaxRequestsPerChild" id="MaxRequestsPerChild">MaxRequestsPerChild</a> <a name="maxrequestsperchild" id="maxrequestsperchild">Directive</a></h2>
416 <table class="directive">
417 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limit on the number of requests that an individual child server
418 will handle during its life</td></tr>
419 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MaxRequestsPerChild <var>number</var></code></td></tr>
420 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MaxRequestsPerChild 10000</code></td></tr>
421 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
422 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
423 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/leader.html">leader</a></code>, <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code>, <code class="module"><a href="../mod/perchild.html">perchild</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/threadpool.html">threadpool</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
425 <p>The <code class="directive">MaxRequestsPerChild</code> directive sets
426 the limit on the number of requests that an individual child
427 server process will handle. After
428 <code class="directive">MaxRequestsPerChild</code> requests, the child
429 process will die. If <code class="directive">MaxRequestsPerChild</code> is
430 <code>0</code>, then the process will never expire.</p>
432 <div class="note"><h3>Different default values</h3>
433 <p>The default value for <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code> and
434 <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code> is <code>0</code>.</p>
437 <p>Setting <code class="directive">MaxRequestsPerChild</code> to a
438 non-zero value limits the amount of memory that process can consume
439 by (accidental) memory leakage.</p>
441 <div class="note"><h3>Note</h3>
442 <p>For <code class="directive"><a href="../mod/core.html#keepalive">KeepAlive</a></code> requests, only
443 the first request is counted towards this limit. In effect, it
444 changes the behavior to limit the number of <em>connections</em> per
449 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
450 <div class="directive-section"><h2><a name="MaxSpareThreads" id="MaxSpareThreads">MaxSpareThreads</a> <a name="maxsparethreads" id="maxsparethreads">Directive</a></h2>
451 <table class="directive">
452 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maximum number of idle threads</td></tr>
453 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MaxSpareThreads <var>number</var></code></td></tr>
454 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr>
455 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
456 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
457 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/beos.html">beos</a></code>, <code class="module"><a href="../mod/leader.html">leader</a></code>, <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code>, <code class="module"><a href="../mod/perchild.html">perchild</a></code>, <code class="module"><a href="../mod/threadpool.html">threadpool</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
459 <p>Maximum number of idle threads. Different MPMs deal with this
460 directive differently.</p>
462 <p>For <code class="module"><a href="../mod/perchild.html">perchild</a></code> the default is
463 <code>MaxSpareThreads 10</code>. This MPM monitors the number of
464 idle threads on a per-child basis. If there are too many idle
465 threads in that child, the server will begin to kill threads
466 within that child.</p>
468 <p>For <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/leader.html">leader</a></code> and <code class="module"><a href="../mod/threadpool.html">threadpool</a></code> the default is <code>MaxSpareThreads 250</code>.
469 These MPMs deal with idle threads on a server-wide basis. If there
470 are too many idle threads in the server then child processes are
471 killed until the number of idle threads is less than this number.</p>
473 <p>For <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code> the default is
474 <code>MaxSpareThreads 100</code>. Since this MPM runs a
475 single-process, the spare thread count is also server-wide.</p>
477 <p><code class="module"><a href="../mod/beos.html">beos</a></code> and <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code> work
478 similar to <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>. The default for
479 <code class="module"><a href="../mod/beos.html">beos</a></code> is <code>MaxSpareThreads 50</code>. For
480 <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code> the default value is <code>10</code>.</p>
482 <div class="note"><h3>Restrictions</h3>
483 <p>The range of the <code class="directive">MaxSpareThreads</code> value
484 is restricted. Apache will correct the given value automatically
485 according to the following rules:</p>
487 <li><code class="module"><a href="../mod/perchild.html">perchild</a></code> requires <code class="directive">MaxSpareThreads</code> to be less or equal than <code class="directive"><a href="#threadlimit">ThreadLimit</a></code>.</li>
489 <li><code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code> wants the value to be greater than
490 <code class="directive"><a href="#minsparethreads">MinSpareThreads</a></code>.</li>
492 <li>For <code class="module"><a href="../mod/leader.html">leader</a></code>, <code class="module"><a href="../mod/threadpool.html">threadpool</a></code> and
493 <code class="module"><a href="../mod/worker.html">worker</a></code> the value must be greater or equal than
494 the sum of <code class="directive"><a href="#minsparethreads">MinSpareThreads</a></code>
495 and <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code>.</li>
501 <li><code class="directive"><a href="#minsparethreads">MinSpareThreads</a></code></li>
502 <li><code class="directive"><a href="#startservers">StartServers</a></code></li>
505 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
506 <div class="directive-section"><h2><a name="MinSpareThreads" id="MinSpareThreads">MinSpareThreads</a> <a name="minsparethreads" id="minsparethreads">Directive</a></h2>
507 <table class="directive">
508 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Minimum number of idle threads available to handle request
510 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MinSpareThreads <var>number</var></code></td></tr>
511 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr>
512 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
513 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
514 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/beos.html">beos</a></code>, <code class="module"><a href="../mod/leader.html">leader</a></code>, <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code>, <code class="module"><a href="../mod/perchild.html">perchild</a></code>, <code class="module"><a href="../mod/threadpool.html">threadpool</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
516 <p>Minimum number of idle threads to handle request spikes.
517 Different MPMs deal with this directive
520 <p><code class="module"><a href="../mod/perchild.html">perchild</a></code> uses a default of
521 <code>MinSpareThreads 5</code> and monitors the number of idle
522 threads on a per-child basis. If there aren't enough idle threads
523 in that child, the server will begin to create new threads within
524 that child. Thus, if you set <code class="directive"><a href="../mod/perchild.html#numservers">NumServers</a></code> to <code>10</code> and a <code class="directive">MinSpareThreads</code> value of <code>5</code>, you'll have
525 at least 50 idle threads on your system.</p>
527 <p><code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/leader.html">leader</a></code> and
528 <code class="module"><a href="../mod/threadpool.html">threadpool</a></code> use a default of <code>MinSpareThreads
529 75</code> and deal with idle threads on a server-wide basis. If
530 there aren't enough idle threads in the server then child
531 processes are created until the number of idle threads is greater
534 <p><code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code> uses a default of
535 <code>MinSpareThreads 10</code> and, since it is a single-process
536 MPM, tracks this on a server-wide bases.</p>
538 <p><code class="module"><a href="../mod/beos.html">beos</a></code> and <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code> work
539 similar to <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>. The default for
540 <code class="module"><a href="../mod/beos.html">beos</a></code> is <code>MinSpareThreads 1</code>. For
541 <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code> the default value is <code>5</code>.</p>
545 <li><code class="directive"><a href="#maxsparethreads">MaxSpareThreads</a></code></li>
546 <li><code class="directive"><a href="#startservers">StartServers</a></code></li>
549 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
550 <div class="directive-section"><h2><a name="PidFile" id="PidFile">PidFile</a> <a name="pidfile" id="pidfile">Directive</a></h2>
551 <table class="directive">
552 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>File where the server records the process ID
553 of the daemon</td></tr>
554 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>PidFile <var>filename</var></code></td></tr>
555 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>PidFile logs/httpd.pid</code></td></tr>
556 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
557 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
558 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/beos.html">beos</a></code>, <code class="module"><a href="../mod/leader.html">leader</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code>, <code class="module"><a href="../mod/perchild.html">perchild</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/threadpool.html">threadpool</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
560 <p>The <code class="directive">PidFile</code> directive sets the file to
561 which the server records the process id of the daemon. If the
562 filename is not absolute then it is assumed to be relative to the
563 <code class="directive"><a href="../mod/core.html#serverroot">ServerRoot</a></code>.</p>
565 <div class="example"><h3>Example</h3><p><code>
566 PidFile /var/run/apache.pid
569 <p>It is often useful to be able to send the server a signal,
570 so that it closes and then re-opens its <code class="directive"><a href="../mod/core.html#errorlog">ErrorLog</a></code> and <code class="directive"><a href="../mod/mod_log_config.html#transferlog">TransferLog</a></code>, and
571 re-reads its configuration files. This is done by sending a
572 SIGHUP (kill -1) signal to the process id listed in the
573 <code class="directive">PidFile</code>.</p>
575 <p>The <code class="directive">PidFile</code> is subject to the same
576 warnings about log file placement and <a href="../misc/security_tips.html#serverroot">security</a>.</p>
578 <div class="note"><h3>Note</h3>
579 <p>As of Apache 2 it is recommended to use only the <code class="program"><a href="../programs/apachectl.html">apachectl</a></code> script for (re-)starting or stopping the server.</p>
583 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
584 <div class="directive-section"><h2><a name="ReceiveBufferSize" id="ReceiveBufferSize">ReceiveBufferSize</a> <a name="receivebuffersize" id="receivebuffersize">Directive</a></h2>
585 <table class="directive">
586 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>TCP receive buffer size</td></tr>
587 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ReceiveBufferSize <var>bytes</var></code></td></tr>
588 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ReceiveBufferSize 0</code></td></tr>
589 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
590 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
591 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/beos.html">beos</a></code>, <code class="module"><a href="../mod/leader.html">leader</a></code>, <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code>, <code class="module"><a href="../mod/perchild.html">perchild</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/threadpool.html">threadpool</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
593 <p>The server will set the TCP receive buffer size to the number of
596 <p>If set to the value of <code>0</code>, the server will use the
600 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
601 <div class="directive-section"><h2><a name="ScoreBoardFile" id="ScoreBoardFile">ScoreBoardFile</a> <a name="scoreboardfile" id="scoreboardfile">Directive</a></h2>
602 <table class="directive">
603 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Location of the file used to store coordination data for
604 the child processes</td></tr>
605 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ScoreBoardFile <var>file-path</var></code></td></tr>
606 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ScoreBoardFile logs/apache_status</code></td></tr>
607 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
608 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
609 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/beos.html">beos</a></code>, <code class="module"><a href="../mod/leader.html">leader</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="../mod/perchild.html">perchild</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/threadpool.html">threadpool</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
611 <p>Apache uses a scoreboard to communicate between its parent
612 and child processes. Some architectures require a file to facilitate
613 this communication. If the file is left unspecified, Apache first
614 attempts to create the scoreboard entirely in memory (using anonymous
615 shared memory) and, failing that, will attempt to create the file on
616 disk (using file-based shared memory). Specifying this directive causes
617 Apache to always create the file on the disk.</p>
619 <div class="example"><h3>Example</h3><p><code>
620 ScoreBoardFile /var/run/apache_status
623 <p>File-based shared memory is useful for third-party applications
624 that require direct access to the scoreboard.</p>
626 <p>If you use a <code class="directive">ScoreBoardFile</code> then
627 you may see improved speed by placing it on a RAM disk. But be
628 careful that you heed the same warnings about log file placement
629 and <a href="../misc/security_tips.html">security</a>.</p>
633 <li><a href="../stopping.html">Stopping and Restarting
637 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
638 <div class="directive-section"><h2><a name="SendBufferSize" id="SendBufferSize">SendBufferSize</a> <a name="sendbuffersize" id="sendbuffersize">Directive</a></h2>
639 <table class="directive">
640 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>TCP buffer size</td></tr>
641 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SendBufferSize <var>bytes</var></code></td></tr>
642 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>SendBufferSize 0</code></td></tr>
643 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
644 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
645 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/beos.html">beos</a></code>, <code class="module"><a href="../mod/leader.html">leader</a></code>, <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code>, <code class="module"><a href="../mod/perchild.html">perchild</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/threadpool.html">threadpool</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
647 <p>The server will set the TCP send buffer size to the number of bytes
648 specified. Very useful to increase past standard OS defaults on
649 high speed high latency (<em>i.e.</em>, 100ms or so, such as
650 transcontinental fast pipes).</p>
652 <p>If set to the value of <code>0</code>, the server will use the
656 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
657 <div class="directive-section"><h2><a name="ServerLimit" id="ServerLimit">ServerLimit</a> <a name="serverlimit" id="serverlimit">Directive</a></h2>
658 <table class="directive">
659 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Upper limit on configurable number of processes</td></tr>
660 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerLimit <var>number</var></code></td></tr>
661 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr>
662 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
663 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
664 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/leader.html">leader</a></code>, <code class="module"><a href="../mod/perchild.html">perchild</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/threadpool.html">threadpool</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
666 <p>For the <code class="module"><a href="../mod/prefork.html">prefork</a></code> MPM, this directive sets the
667 maximum configured value for <code class="directive"><a href="#maxclients">MaxClients</a></code> for the lifetime of the
668 Apache process. For the <code class="module"><a href="../mod/worker.html">worker</a></code> MPM, this directive
669 in combination with <code class="directive"><a href="#threadlimit">ThreadLimit</a></code> sets
670 the maximum configured value for <code class="directive"><a href="#maxclients">MaxClients</a></code> for the lifetime of the
671 Apache process. Any attempts to change this directive during a
672 restart will be ignored, but <code class="directive"><a href="#maxclients">MaxClients</a></code> can be modified during
675 <p>Special care must be taken when using this directive. If
676 <code class="directive">ServerLimit</code> is set to a value much higher
677 than necessary, extra, unused shared memory will be allocated. If
678 both <code class="directive">ServerLimit</code> and <code class="directive"><a href="#maxclients">MaxClients</a></code> are set to values
679 higher than the system can handle, Apache may not start or the
680 system may become unstable.</p>
682 <p>With the <code class="module"><a href="../mod/prefork.html">prefork</a></code> MPM, use this directive only
683 if you need to set <code class="directive"><a href="#maxclients">MaxClients</a></code> higher than 256 (default).
684 Do not set the value of this directive any higher than what you
685 might want to set <code class="directive"><a href="#maxclients">MaxClients</a></code> to.</p>
687 <p>With <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/leader.html">leader</a></code> and
688 <code class="module"><a href="../mod/threadpool.html">threadpool</a></code> use this directive only
689 if your <code class="directive"><a href="#maxclients">MaxClients</a></code> and
690 <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code>
691 settings require more than 16 server processes (default). Do not set
692 the value of this directive any higher than the number of server
693 processes required by what you may want for <code class="directive"><a href="#maxclients ">MaxClients </a></code> and <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code>.</p>
695 <p>With the <code class="module"><a href="../mod/perchild.html">perchild</a></code> MPM, use this directive only
696 if you need to set <code class="directive"><a href="../mod/perchild.html#numservers">NumServers</a></code> higher than 8 (default).</p>
698 <div class="note"><h3>Note</h3>
699 <p>There is a hard limit of <code>ServerLimit 20000</code> compiled
700 into the server. This is intended to avoid nasty effects caused by
706 <li><a href="../stopping.html">Stopping and Restarting Apache</a></li>
709 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
710 <div class="directive-section"><h2><a name="StartServers" id="StartServers">StartServers</a> <a name="startservers" id="startservers">Directive</a></h2>
711 <table class="directive">
712 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Number of child server processes created at startup</td></tr>
713 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>StartServers <var>number</var></code></td></tr>
714 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr>
715 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
716 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
717 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/leader.html">leader</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/threadpool.html">threadpool</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
719 <p>The <code class="directive">StartServers</code> directive sets the
720 number of child server processes created on startup. As the number
721 of processes is dynamically controlled depending on the load,
722 there is usually little reason to adjust this parameter.</p>
724 <p>The default value differs from MPM to MPM. For
725 <code class="module"><a href="../mod/leader.html">leader</a></code>, <code class="module"><a href="../mod/threadpool.html">threadpool</a></code> and
726 <code class="module"><a href="../mod/worker.html">worker</a></code> the default is <code>StartServers 3</code>.
727 For <code class="module"><a href="../mod/prefork.html">prefork</a></code> defaults to <code>5</code> and for
728 <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code> to <code>2</code>.</p>
731 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
732 <div class="directive-section"><h2><a name="StartThreads" id="StartThreads">StartThreads</a> <a name="startthreads" id="startthreads">Directive</a></h2>
733 <table class="directive">
734 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Number of threads created on startup</td></tr>
735 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>StartThreads <var>number</var></code></td></tr>
736 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr>
737 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
738 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
739 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/beos.html">beos</a></code>, <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>, <code class="module"><a href="../mod/perchild.html">perchild</a></code></td></tr>
741 <p>Number of threads created on startup. As the
742 number of threads is dynamically controlled depending on the
743 load, there is usually little reason to adjust this
746 <p>For <code class="module"><a href="../mod/perchild.html">perchild</a></code> the default is <code>StartThreads
747 5</code> and this directive tracks the number of threads per
748 process at startup.</p>
750 <p>For <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code> the default is
751 <code>StartThreads 50</code> and, since there is only a single
752 process, this is the total number of threads created at startup to
755 <p>For <code class="module"><a href="../mod/beos.html">beos</a></code> the default is <code>StartThreads
756 10</code>. It also reflects the total number of threads created
757 at startup to serve requests.</p>
760 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
761 <div class="directive-section"><h2><a name="ThreadLimit" id="ThreadLimit">ThreadLimit</a> <a name="threadlimit" id="threadlimit">Directive</a></h2>
762 <table class="directive">
763 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets the upper limit on the configurable number of threads
764 per child process</td></tr>
765 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ThreadLimit <var>number</var></code></td></tr>
766 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr>
767 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
768 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
769 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/leader.html">leader</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="../mod/perchild.html">perchild</a></code>, <code class="module"><a href="../mod/threadpool.html">threadpool</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
770 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available for <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code> in Apache 2.0.41
773 <p>This directive sets the maximum configured value for <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code> for the lifetime
774 of the Apache process. Any attempts to change this directive
775 during a restart will be ignored, but <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code> can be modified
776 during a restart up to the value of this directive.</p>
778 <p>Special care must be taken when using this directive. If
779 <code class="directive">ThreadLimit</code> is set to a value much higher
780 than <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code>,
781 extra unused shared memory will be allocated. If both
782 <code class="directive">ThreadLimit</code> and <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code> are set to values
783 higher than the system can handle, Apache may not start or the
784 system may become unstable. Do not set the value of this directive
785 any higher than your greatest predicted setting of <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code> for the
786 current run of Apache.</p>
788 <p>The default value for <code class="directive">ThreadLimit</code> is
789 <code>1920</code> when used with <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code> and
790 <code>64</code> when used with the others.</p>
792 <div class="note"><h3>Note</h3>
793 <p>There is a hard limit of <code>ThreadLimit 20000</code> (or
794 <code>ThreadLimit 15000</code> with <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>)
795 compiled into the server. This is intended to avoid nasty effects
800 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
801 <div class="directive-section"><h2><a name="ThreadsPerChild" id="ThreadsPerChild">ThreadsPerChild</a> <a name="threadsperchild" id="threadsperchild">Directive</a></h2>
802 <table class="directive">
803 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Number of threads created by each child process</td></tr>
804 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ThreadsPerChild <var>number</var></code></td></tr>
805 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr>
806 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
807 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
808 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/leader.html">leader</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="../mod/threadpool.html">threadpool</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
810 <p>This directive sets the number of threads created by each
811 child process. The child creates these threads at startup and
812 never creates more. If using an MPM like <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>,
813 where there is only one child process, this number should be high
814 enough to handle the entire load of the server. If using an MPM
815 like <code class="module"><a href="../mod/worker.html">worker</a></code>, where there are multiple child processes,
816 the <em>total</em> number of threads should be high enough to handle
817 the common load on the server.</p>
819 <p>The default value for <code class="directive">ThreadsPerChild</code> is
820 <code>64</code> when used with <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code> and
821 <code>25</code> when used with the others.</p>
824 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
825 <div class="directive-section"><h2><a name="User" id="User">User</a> <a name="user" id="user">Directive</a></h2>
826 <table class="directive">
827 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>The userid under which the server will answer
829 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>User <var>unix-userid</var></code></td></tr>
830 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>User #-1</code></td></tr>
831 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
832 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
833 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/leader.html">leader</a></code>, <code class="module"><a href="../mod/perchild.html">perchild</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/threadpool.html">threadpool</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
834 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Only valid in global server config since Apache
837 <p>The <code class="directive">User</code> directive sets the user ID as
838 which the server will answer requests. In order to use this
839 directive, the server must be run initially as <code>root</code>.
840 If you start the server as a non-root user, it will fail to change
841 to the lesser privileged user, and will instead continue to run as
842 that original user. If you do start the server as <code>root</code>,
843 then it is normal for the parent process to remain running as root.
844 <var>Unix-userid</var> is one of:</p>
848 <dd>Refers to the given user by name.</dd>
850 <dt># followed by a user number.</dt>
851 <dd>Refers to a user by its number.</dd>
854 <p>The user should have no privileges that result in it being
855 able to access files that are not intended to be visible to the
856 outside world, and similarly, the user should not be able to
857 execute code that is not meant for HTTP requests. It is
858 recommended that you set up a new user and group specifically for
859 running the server. Some admins use user <code>nobody</code>, but
860 this is not always desirable, since the <code>nobody</code> user
861 can have other uses on the system.</p>
863 <div class="warning"><h3>Security</h3>
864 <p>Don't set <code class="directive">User</code> (or <code class="directive"><a href="#group">Group</a></code>) to <code>root</code> unless
865 you know exactly what you are doing, and what the dangers are.</p>
868 <p>With the <code class="module"><a href="../mod/perchild.html">perchild</a></code> MPM, which is intended to
869 server virtual hosts run under different user IDs, the
870 <code class="directive">User</code> directive defines the user ID for the
871 main server and the fallback for <code class="directive"><a href="../mod/core.html#virtualhost"><VirtualHost></a></code> sections without an
872 <code class="directive"><a href="../mod/perchild.html#assignuserid">AssignUserID</a></code> directive.</p>
874 <p>Special note: Use of this directive in <code class="directive"><a href="../mod/core.html#virtualhost"><VirtualHost></a></code> is no longer supported. To
875 configure your server for <code class="program"><a href="../programs/suexec.html">suexec</a></code> use
876 <code class="directive"><a href="../mod/mod_suexec.html#suexecusergroup">SuexecUserGroup</a></code>.</p>
878 <div class="note"><h3>Note</h3>
879 <p>Although the <code class="directive">User</code> directive is present
880 in the <code class="module"><a href="../mod/beos.html">beos</a></code> and <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code> MPMs,
881 it is actually a no-op there and only exists for compatibility
887 <div class="bottomlang">
888 <p><span>Available Languages: </span><a href="../de/mod/mpm_common.html" hreflang="de" rel="alternate" title="Deutsch"> de </a> |
889 <a href="../en/mod/mpm_common.html" title="English"> en </a> |
890 <a href="../es/mod/mpm_common.html" hreflang="es" rel="alternate" title="Español"> es </a> |
891 <a href="../ja/mod/mpm_common.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
892 <a href="../tr/mod/mpm_common.html" hreflang="tr" rel="alternate" title="Türkçe"> tr </a></p>
893 </div><div id="footer">
894 <p class="apache">Copyright 2009 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
895 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div>