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
7      -->
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" /><link rel="stylesheet" type="text/css" href="/style/css/prettify.css" />
12<script src="/style/scripts/prettify.js" type="text/javascript">
13</script>
14
15<link href="/images/favicon.ico" rel="shortcut icon" /></head>
16<body>
17<div id="page-header">
18<p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p>
19<p class="apache">Apache HTTP Server Version 2.2</p>
20<img alt="" src="/images/feather.gif" /></div>
21<div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="/images/left.gif" /></a></div>
22<div id="path">
23<a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs/">Documentation</a> &gt; <a href="../">Version 2.2</a> &gt; <a href="./">Modules</a></div>
24<div id="page-content">
25<div id="preamble"><h1>Apache MPM Common Directives</h1>
26<div class="toplang">
27<p><span>Available Languages: </span><a href="/de/mod/mpm_common.html" hreflang="de" rel="alternate" title="Deutsch">&nbsp;de&nbsp;</a> |
28<a href="/en/mod/mpm_common.html" title="English">&nbsp;en&nbsp;</a> |
29<a href="/ja/mod/mpm_common.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a> |
30<a href="/tr/mod/mpm_common.html" hreflang="tr" rel="alternate" title="T�rk�e">&nbsp;tr&nbsp;</a></p>
31</div>
32<table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>A collection of directives that are implemented by
33more than one multi-processing module (MPM)</td></tr>
34<tr><th><a href="module-dict.html#Status">Status:</a></th><td>MPM</td></tr></table>
35</div>
36<div id="quickview"><h3 class="directives">Directives</h3>
37<ul id="toc">
38<li><img alt="" src="/images/down.gif" /> <a href="#acceptmutex">AcceptMutex</a></li>
39<li><img alt="" src="/images/down.gif" /> <a href="#chrootdir">ChrootDir</a></li>
40<li><img alt="" src="/images/down.gif" /> <a href="#coredumpdirectory">CoreDumpDirectory</a></li>
41<li><img alt="" src="/images/down.gif" /> <a href="#enableexceptionhook">EnableExceptionHook</a></li>
42<li><img alt="" src="/images/down.gif" /> <a href="#gracefulshutdowntimeout">GracefulShutdownTimeout</a></li>
43<li><img alt="" src="/images/down.gif" /> <a href="#group">Group</a></li>
44<li><img alt="" src="/images/down.gif" /> <a href="#listen">Listen</a></li>
45<li><img alt="" src="/images/down.gif" /> <a href="#listenbacklog">ListenBackLog</a></li>
46<li><img alt="" src="/images/down.gif" /> <a href="#lockfile">LockFile</a></li>
47<li><img alt="" src="/images/down.gif" /> <a href="#maxclients">MaxClients</a></li>
48<li><img alt="" src="/images/down.gif" /> <a href="#maxmemfree">MaxMemFree</a></li>
49<li><img alt="" src="/images/down.gif" /> <a href="#maxrequestsperchild">MaxRequestsPerChild</a></li>
50<li><img alt="" src="/images/down.gif" /> <a href="#maxsparethreads">MaxSpareThreads</a></li>
51<li><img alt="" src="/images/down.gif" /> <a href="#minsparethreads">MinSpareThreads</a></li>
52<li><img alt="" src="/images/down.gif" /> <a href="#pidfile">PidFile</a></li>
53<li><img alt="" src="/images/down.gif" /> <a href="#receivebuffersize">ReceiveBufferSize</a></li>
54<li><img alt="" src="/images/down.gif" /> <a href="#scoreboardfile">ScoreBoardFile</a></li>
55<li><img alt="" src="/images/down.gif" /> <a href="#sendbuffersize">SendBufferSize</a></li>
56<li><img alt="" src="/images/down.gif" /> <a href="#serverlimit">ServerLimit</a></li>
57<li><img alt="" src="/images/down.gif" /> <a href="#startservers">StartServers</a></li>
58<li><img alt="" src="/images/down.gif" /> <a href="#startthreads">StartThreads</a></li>
59<li><img alt="" src="/images/down.gif" /> <a href="#threadlimit">ThreadLimit</a></li>
60<li><img alt="" src="/images/down.gif" /> <a href="#threadsperchild">ThreadsPerChild</a></li>
61<li><img alt="" src="/images/down.gif" /> <a href="#threadstacksize">ThreadStackSize</a></li>
62<li><img alt="" src="/images/down.gif" /> <a href="#user">User</a></li>
63</ul>
64<ul class="seealso"><li><a href="#comments_section">Comments</a></li></ul></div>
65
66<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
67<div class="directive-section"><h2><a name="AcceptMutex" id="AcceptMutex">AcceptMutex</a> <a name="acceptmutex" id="acceptmutex">Directive</a></h2>
68<table class="directive">
69<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Method that Apache uses to serialize multiple children
70accepting requests on network sockets</td></tr>
71<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AcceptMutex Default|<var>method</var></code></td></tr>
72<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AcceptMutex Default</code></td></tr>
73<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
74<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
75<tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="/mod/prefork.html">prefork</a></code>, <code class="module"><a href="/mod/worker.html">worker</a></code></td></tr>
76</table>
77    <p>The <code class="directive">AcceptMutex</code> directives sets the
78    method that Apache uses to serialize multiple children accepting
79    requests on network sockets. Prior to Apache 2.0, the method was
80    selectable only at compile time. The optimal method to use is
81    highly architecture and platform dependent. For further details,
82    see the <a href="/misc/perf-tuning.html">performance tuning</a>
83    documentation.</p>
84
85    <p>If this directive is set to <code>Default</code>, then the
86    compile-time selected default will be used. Other possible
87    methods are listed below. Note that not all methods are
88    available on all platforms. If a method is specified which is
89    not available, a message will be written to the error log
90    listing the available methods.</p>
91
92    <dl>
93      <dt><code>flock</code></dt>
94      <dd>uses the <code>flock(2)</code> system call to lock the
95      file defined by the <code class="directive"><a href="#lockfile">LockFile</a></code> directive.</dd>
96
97      <dt><code>fcntl</code></dt>
98      <dd>uses the <code>fcntl(2)</code> system call to lock the
99      file defined by the <code class="directive"><a href="#lockfile">LockFile</a></code> directive.</dd>
100
101      <dt><code>posixsem</code></dt>
102      <dd>uses POSIX compatible semaphores to implement the mutex.</dd>
103
104      <dt><code>pthread</code></dt>
105      <dd>uses POSIX mutexes as implemented by the POSIX Threads
106      (PThreads) specification.</dd>
107
108      <dt><code>sysvsem</code></dt>
109      <dd>uses SySV-style semaphores to implement the mutex.</dd>
110    </dl>
111
112    <p>If you want to find out the compile time chosen default
113    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>
114
115  <div class="warning"><h3>Warning</h3>
116     <p>On most systems, when the <code>pthread</code> option
117     is selected, if a child process terminates abnormally
118     while holding the <code>AcceptCntl</code> mutex the
119     server will stop responding to requests. When this
120     occurs, the server will require a manual restart to
121     recover.</p>
122     <p>Solaris is a notable exception as it provides a
123     mechanism, used by Apache, which usually allows the
124     mutex to be recovered after a child process terminates
125     abnormally while holding a mutex.</p>
126     <p>If your system implements the
127     <code>pthread_mutexattr_setrobust_np()</code> function,
128     you may be able to use the <code>pthread</code> option safely.</p>
129  </div>
130
131</div>
132<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
133<div class="directive-section"><h2><a name="ChrootDir" id="ChrootDir">ChrootDir</a> <a name="chrootdir" id="chrootdir">Directive</a></h2>
134<table class="directive">
135<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Directory for apache to run chroot(8) after startup.</td></tr>
136<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ChrootDir <var>/path/to/directory</var></code></td></tr>
137<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>none</code></td></tr>
138<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
139<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
140<tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="/mod/event.html">event</a></code>, <code class="module"><a href="/mod/prefork.html">prefork</a></code>, <code class="module"><a href="/mod/worker.html">worker</a></code></td></tr>
141<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.2.10 and later</td></tr>
142</table>
143    <p>This directive tells the server to <var>chroot(8)</var> to the
144    specified directory after startup, but before accepting requests.</p>
145
146    <p>Note that running the server under chroot is not
147    simple, and requires additional setup, particularly if you are running
148    scripts such as CGI or PHP.  Please make sure you are properly familiar
149    with the operation of chroot before attempting to use this feature.</p>
150
151</div>
152<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
153<div class="directive-section"><h2><a name="CoreDumpDirectory" id="CoreDumpDirectory">CoreDumpDirectory</a> <a name="coredumpdirectory" id="coredumpdirectory">Directive</a></h2>
154<table class="directive">
155<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Directory where Apache attempts to
156switch before dumping core</td></tr>
157<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>CoreDumpDirectory <var>directory</var></code></td></tr>
158<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for the default setting</code></td></tr>
159<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
160<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
161<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_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="/mod/prefork.html">prefork</a></code>, <code class="module"><a href="/mod/worker.html">worker</a></code></td></tr>
162</table>
163    <p>This controls the directory to which Apache attempts to
164    switch before dumping core. The default is in the
165    <code class="directive"><a href="/mod/core.html#serverroot">ServerRoot</a></code> directory, however
166    since this should not be writable by the user the server runs
167    as, core dumps won't normally get written. If you want a core
168    dump for debugging, you can use this directive to place it in a
169    different location.</p>
170
171    <div class="note"><h3>Core Dumps on Linux</h3>
172      <p>If Apache starts as root and switches to another user, the
173      Linux kernel <em>disables</em> core dumps even if the directory is
174      writable for the process. Apache (2.0.46 and later) reenables core dumps
175      on Linux 2.4 and beyond, but only if you explicitly configure a <code class="directive">CoreDumpDirectory</code>.</p>
176    </div>
177
178    <div class="note"><h3>Core Dumps on BSD</h3>
179    <p>To enable core-dumping of suid-executables on BSD-systems (such
180    as FreeBSD), set <code>kern.sugid_coredump</code> to 1.
181    </p></div>
182
183
184</div>
185<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
186<div class="directive-section"><h2><a name="EnableExceptionHook" id="EnableExceptionHook">EnableExceptionHook</a> <a name="enableexceptionhook" id="enableexceptionhook">Directive</a></h2>
187<table class="directive">
188<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enables a hook that runs exception handlers
189after a crash</td></tr>
190<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>EnableExceptionHook On|Off</code></td></tr>
191<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>EnableExceptionHook Off</code></td></tr>
192<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
193<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
194<tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="/mod/prefork.html">prefork</a></code>, <code class="module"><a href="/mod/worker.html">worker</a></code></td></tr>
195<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in version 2.0.49 and later</td></tr>
196</table>
197    <p>For safety reasons this directive is only available if the server was
198    configured with the <code>--enable-exception-hook</code> option. It
199    enables a hook that allows external modules to plug in and do something
200    after a child crashed.</p>
201    
202    <p>There are already two modules, <code>mod_whatkilledus</code> and
203    <code>mod_backtrace</code> that make use of this hook. Please have a
204    look at Jeff Trawick's <a href="http://www.apache.org/~trawick/exception_hook.html">EnableExceptionHook site</a> for more information about these.</p>
205
206</div>
207<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
208<div class="directive-section"><h2><a name="GracefulShutdownTimeout" id="GracefulShutdownTimeout">GracefulShutdownTimeout</a> <a name="gracefulshutdowntimeout" id="gracefulshutdowntimeout">Directive</a></h2>
209<table class="directive">
210<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Specify a timeout after which a gracefully shutdown server
211will exit.</td></tr>
212<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>GracefulShutDownTimeout <var>seconds</var></code></td></tr>
213<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>GracefulShutDownTimeout 0</code></td></tr>
214<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
215<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
216<tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="/mod/prefork.html">prefork</a></code>, <code class="module"><a href="/mod/worker.html">worker</a></code>, <code class="module"><a href="/mod/event.html">event</a></code></td></tr>
217<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in version 2.2 and later</td></tr>
218</table>
219    <p>The <code class="directive">GracefulShutdownTimeout</code> specifies
220    how many seconds after receiving a "graceful-stop" signal, a 
221    server should continue to run, handling the existing connections.</p>
222
223    <p>Setting this value to zero means that the server will wait
224    indefinitely until all remaining requests have been fully served.</p>
225
226</div>
227<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
228<div class="directive-section"><h2><a name="Group" id="Group">Group</a> <a name="group" id="group">Directive</a></h2>
229<table class="directive">
230<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Group under which the server will answer
231requests</td></tr>
232<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Group <var>unix-group</var></code></td></tr>
233<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>Group #-1</code></td></tr>
234<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
235<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
236<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/mpmt_os2.html">mpmt_os2</a></code>, <code class="module"><a href="/mod/prefork.html">prefork</a></code>, <code class="module"><a href="/mod/worker.html">worker</a></code></td></tr>
237<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Only valid in global server config since Apache
2382.0</td></tr>
239</table>
240    <p>The <code class="directive">Group</code> directive sets the group under
241    which the server will answer requests. In order to use this
242    directive, the server must be run initially as <code>root</code>. If
243    you start the server as a non-root user, it will fail to change to the
244    specified group, and will instead continue to run as the group of the
245    original user. <var>Unix-group</var> is one of:</p>
246
247    <dl>
248      <dt>A group name</dt>
249      <dd>Refers to the given group by name.</dd>
250
251      <dt><code>#</code> followed by a group number.</dt>
252      <dd>Refers to a group by its number.</dd>
253    </dl>
254
255    <div class="example"><h3>Example</h3><p><code>
256      Group www-group
257    </code></p></div>
258
259    <p>It is recommended that you set up a new group specifically for
260    running the server. Some admins use user <code>nobody</code>,
261    but this is not always possible or desirable.</p>
262
263    <div class="warning"><h3>Security</h3>
264      <p>Don't set <code class="directive">Group</code> (or <code class="directive"><a href="#user">User</a></code>) to <code>root</code> unless
265      you know exactly what you are doing, and what the dangers are.</p>
266    </div>
267
268    <p>Special note: Use of this directive in <code class="directive"><a href="/mod/core.html#virtualhost">&lt;VirtualHost&gt;</a></code> is no longer supported. To
269    configure your server for <code class="program"><a href="/programs/suexec.html">suexec</a></code> use
270    <code class="directive"><a href="/mod/mod_suexec.html#suexecusergroup">SuexecUserGroup</a></code>.</p>
271
272    <div class="note"><h3>Note</h3>
273      <p>Although the <code class="directive">Group</code> directive is present
274      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,
275      it is actually a no-op there and only exists for compatibility
276      reasons.</p>
277    </div>
278
279</div>
280<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
281<div class="directive-section"><h2><a name="Listen" id="Listen">Listen</a> <a name="listen" id="listen">Directive</a></h2>
282<table class="directive">
283<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>IP addresses and ports that the server
284listens to</td></tr>
285<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Listen [<var>IP-address</var>:]<var>portnumber</var> [<var>protocol</var>]</code></td></tr>
286<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
287<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
288<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/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/prefork.html">prefork</a></code>, <code class="module"><a href="/mod/worker.html">worker</a></code>, <code class="module"><a href="/mod/event.html">event</a></code></td></tr>
289<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Required directive since Apache 2.0<br />
290The <var>protocol</var> argument was added in 2.1.5</td></tr>
291</table>
292    <p>The <code class="directive">Listen</code> directive instructs Apache to
293    listen to only specific IP addresses or ports; by default it
294    responds to requests on all IP interfaces. <code class="directive">Listen</code>
295    is now a required directive. If it is not in the config file, the
296    server will fail to start. This is a change from previous versions
297    of Apache.</p>
298
299    <p>The <code class="directive">Listen</code> directive tells the server to
300    accept incoming requests on the specified port or address-and-port
301    combination. If only a port number is specified, the server listens to
302    the given port on all interfaces. If an IP address is given as well
303    as a port, the server will listen on the given port and
304    interface.</p>
305
306    <p>Multiple <code class="directive">Listen</code> directives may be used to
307    specify a number of addresses and ports to listen to. The server will
308    respond to requests from any of the listed addresses and ports.</p>
309
310    <p>For example, to make the server accept connections on both
311    port 80 and port 8000, use:</p>
312
313    <div class="example"><p><code>
314      Listen 80<br />
315      Listen 8000
316    </code></p></div>
317
318    <p>To make the server accept connections on two specified
319    interfaces and port numbers, use </p>
320
321    <div class="example"><p><code>
322      Listen 192.170.2.1:80<br />
323      Listen 192.170.2.5:8000
324    </code></p></div>
325
326    <p>IPv6 addresses must be surrounded in square brackets, as in the
327    following example:</p>
328
329    <div class="example"><p><code>
330      Listen [2001:db8::a00:20ff:fea7:ccea]:80
331    </code></p></div>
332
333    <p>The optional <var>protocol</var> argument is not required for most 
334       configurations. If not specified, <code>https</code> is the default for 
335       port 443 and <code>http</code> the default for all other ports.  The 
336       protocol is used to determine which module should handle a request, and
337       to apply protocol specific optimizations with the 
338       <code class="directive"><a href="/mod/core.html#acceptfilter">AcceptFilter</a></code> directive.</p>
339
340    <p>You only need to set the protocol if you are running on non-standard 
341       ports.  For example, running an <code>https</code> site on port 8443:</p>
342
343    <div class="example"><p><code>
344      Listen 192.170.2.1:8443 https
345    </code></p></div>
346
347    <div class="note"><h3>Error condition</h3>
348      Multiple <code class="directive">Listen</code> directives for the same ip
349      address and port will result in an <code>Address already in use</code>
350      error message.
351    </div>
352
353
354<h3>See also</h3>
355<ul>
356<li><a href="/dns-caveats.html">DNS Issues</a></li>
357<li><a href="/bind.html">Setting which addresses and ports Apache
358    uses</a></li>
359</ul>
360</div>
361<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
362<div class="directive-section"><h2><a name="ListenBackLog" id="ListenBackLog">ListenBackLog</a> <a name="listenbacklog" id="listenbacklog">Directive</a></h2>
363<table class="directive">
364<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maximum length of the queue of pending connections</td></tr>
365<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ListenBacklog <var>backlog</var></code></td></tr>
366<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ListenBacklog 511</code></td></tr>
367<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
368<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
369<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/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/prefork.html">prefork</a></code>, <code class="module"><a href="/mod/worker.html">worker</a></code></td></tr>
370</table>
371    <p>The maximum length of the queue of pending connections.
372    Generally no tuning is needed or desired, however on some
373    systems it is desirable to increase this when under a TCP SYN
374    flood attack. See the backlog parameter to the
375    <code>listen(2)</code> system call.</p>
376
377    <p>This will often be limited to a smaller number by the
378    operating system. This varies from OS to OS. Also note that
379    many OSes do not use exactly what is specified as the backlog,
380    but use a number based on (but normally larger than) what is
381    set.</p>
382
383</div>
384<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
385<div class="directive-section"><h2><a name="LockFile" id="LockFile">LockFile</a> <a name="lockfile" id="lockfile">Directive</a></h2>
386<table class="directive">
387<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Location of the accept serialization lock file</td></tr>
388<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LockFile <var>filename</var></code></td></tr>
389<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LockFile logs/accept.lock</code></td></tr>
390<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
391<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
392<tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="/mod/prefork.html">prefork</a></code>, <code class="module"><a href="/mod/worker.html">worker</a></code></td></tr>
393</table>
394    <p>The <code class="directive">LockFile</code> directive sets the path to
395    the lockfile used when Apache is used with an <code class="directive"><a href="#acceptmutex">AcceptMutex</a></code> value of either
396    <code>fcntl</code> or <code>flock</code>. This directive should
397    normally be left at its default value. The main reason for changing
398    it is if the <code>logs</code> directory is NFS mounted, since
399    <strong>the lockfile must be stored on a local disk</strong>. The PID
400    of the main server process is automatically appended to the
401    filename.</p>
402
403    <div class="warning"><h3>Security</h3>
404      <p>It is best to <em>avoid</em> putting this file in a world writable
405      directory such as <code>/var/tmp</code> because someone could create
406      a denial of service attack and prevent the server from starting by
407      creating a lockfile with the same name as the one the server will try
408      to create.</p>
409    </div>
410
411<h3>See also</h3>
412<ul>
413<li><code class="directive"><a href="#acceptmutex">AcceptMutex</a></code></li>
414</ul>
415</div>
416<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
417<div class="directive-section"><h2><a name="MaxClients" id="MaxClients">MaxClients</a> <a name="maxclients" id="maxclients">Directive</a></h2>
418<table class="directive">
419<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maximum number of connections that will be processed
420simultaneously</td></tr>
421<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MaxClients <var>number</var></code></td></tr>
422<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr>
423<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
424<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
425<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/prefork.html">prefork</a></code>, <code class="module"><a href="/mod/worker.html">worker</a></code></td></tr>
426</table>
427    <p>The <code class="directive">MaxClients</code> directive sets the limit
428    on the number of simultaneous requests that will be served.  Any
429    connection attempts over the <code class="directive">MaxClients</code>
430    limit will normally be queued, up to a number based on the
431    <code class="directive"><a href="#listenbacklog">ListenBacklog</a></code>
432    directive. Once a child process is freed at the end of a different
433    request, the connection will then be serviced.</p>
434
435    <p>For non-threaded servers (<em>i.e.</em>, <code class="module"><a href="/mod/prefork.html">prefork</a></code>),
436    <code class="directive">MaxClients</code> translates into the maximum
437    number of child processes that will be launched to serve requests.
438    The default value is <code>256</code>; to increase it, you must also raise
439    <code class="directive"><a href="#serverlimit">ServerLimit</a></code>.</p>
440
441    <p>For threaded and hybrid servers (<em>e.g.</em> <code class="module"><a href="/mod/beos.html">beos</a></code>
442    or <code class="module"><a href="/mod/worker.html">worker</a></code>) <code class="directive">MaxClients</code> restricts
443    the total number of threads that will be available to serve clients.
444    The default value for <code class="module"><a href="/mod/beos.html">beos</a></code> is <code>50</code>. For
445    hybrid MPMs the default value is <code>16</code> (<code class="directive"><a href="#serverlimit">ServerLimit</a></code>) multiplied by the value of
446    <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,
447    you must also raise <code class="directive"><a href="#serverlimit">ServerLimit</a></code>.</p>
448
449</div>
450<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
451<div class="directive-section"><h2><a name="MaxMemFree" id="MaxMemFree">MaxMemFree</a> <a name="maxmemfree" id="maxmemfree">Directive</a></h2>
452<table class="directive">
453<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maximum amount of memory that the main allocator is allowed
454to hold without calling <code>free()</code></td></tr>
455<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MaxMemFree <var>KBytes</var></code></td></tr>
456<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MaxMemFree 0</code></td></tr>
457<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
458<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
459<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/prefork.html">prefork</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>
460</table>
461    <p>The <code class="directive">MaxMemFree</code> directive sets the
462    maximum number of free Kbytes that the main allocator is allowed
463    to hold without calling <code>free()</code>. When not set, or when set
464    to zero, the threshold will be set to unlimited.</p>
465
466</div>
467<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
468<div class="directive-section"><h2><a name="MaxRequestsPerChild" id="MaxRequestsPerChild">MaxRequestsPerChild</a> <a name="maxrequestsperchild" id="maxrequestsperchild">Directive</a></h2>
469<table class="directive">
470<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limit on the number of requests that an individual child server
471will handle during its life</td></tr>
472<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MaxRequestsPerChild <var>number</var></code></td></tr>
473<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MaxRequestsPerChild 10000</code></td></tr>
474<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
475<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
476<tr><th><a href="directive-dict.html#Module">Module:</a></th><td><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/prefork.html">prefork</a></code>, <code class="module"><a href="/mod/worker.html">worker</a></code></td></tr>
477</table>
478    <p>The <code class="directive">MaxRequestsPerChild</code> directive sets
479    the limit on the number of requests that an individual child
480    server process will handle. After
481    <code class="directive">MaxRequestsPerChild</code> requests, the child
482    process will die. If <code class="directive">MaxRequestsPerChild</code> is
483    <code>0</code>, then the process will never expire.</p>
484
485    <div class="note"><h3>Different default values</h3>
486      <p>The default value for <code class="module"><a href="/mod/mpm_netware.html">mpm_netware</a></code> and
487      <code class="module"><a href="/mod/mpm_winnt.html">mpm_winnt</a></code> is <code>0</code>.</p>
488    </div>
489
490    <p>Setting <code class="directive">MaxRequestsPerChild</code> to a
491    non-zero value limits the amount of memory that process can consume
492    by (accidental) memory leakage.</p>
493
494    <div class="note"><h3>Note</h3>
495      <p>For <code class="directive"><a href="/mod/core.html#keepalive">KeepAlive</a></code> requests, only
496      the first request is counted towards this limit. In effect, it
497      changes the behavior to limit the number of <em>connections</em> per
498      child.</p>
499    </div>
500    <div class="note"><h3>Default Configuration</h3>
501      <p>The default (compiled-in) value of this setting (10000) is used when
502      no <code class="directive">MaxRequestsPerChild</code> directive is present in the
503      configuration.  Many default configurations provided with the server include
504      "MaxRequestsPerChild 0" as part of the <em>default configuration</em>.</p>
505</div>
506
507
508</div>
509<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
510<div class="directive-section"><h2><a name="MaxSpareThreads" id="MaxSpareThreads">MaxSpareThreads</a> <a name="maxsparethreads" id="maxsparethreads">Directive</a></h2>
511<table class="directive">
512<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maximum number of idle threads</td></tr>
513<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MaxSpareThreads <var>number</var></code></td></tr>
514<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr>
515<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
516<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
517<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/mpmt_os2.html">mpmt_os2</a></code>, <code class="module"><a href="/mod/worker.html">worker</a></code></td></tr>
518</table>
519    <p>Maximum number of idle threads. Different MPMs deal with this
520    directive differently.</p>
521
522    <p>For <code class="module"><a href="/mod/worker.html">worker</a></code>,
523    the default is <code>MaxSpareThreads 250</code>.
524    These MPMs deal with idle threads on a server-wide basis. If there
525    are too many idle threads in the server then child processes are
526    killed until the number of idle threads is less than this number.</p>
527
528    <p>For <code class="module"><a href="/mod/mpm_netware.html">mpm_netware</a></code> the default is
529    <code>MaxSpareThreads 100</code>. Since this MPM runs a
530    single-process, the spare thread count is also server-wide.</p>
531
532    <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
533    similar to <code class="module"><a href="/mod/mpm_netware.html">mpm_netware</a></code>. The default for
534    <code class="module"><a href="/mod/beos.html">beos</a></code> is <code>MaxSpareThreads 50</code>. For
535    <code class="module"><a href="/mod/mpmt_os2.html">mpmt_os2</a></code> the default value is <code>10</code>.</p>
536
537    <div class="note"><h3>Restrictions</h3>
538      <p>The range of the <code class="directive">MaxSpareThreads</code> value
539      is restricted. Apache will correct the given value automatically
540      according to the following rules:</p>
541      <ul>
542
543        <li><code class="module"><a href="/mod/mpm_netware.html">mpm_netware</a></code> wants the value to be greater than
544        <code class="directive"><a href="#minsparethreads">MinSpareThreads</a></code>.</li>
545
546        <li>For
547        <code class="module"><a href="/mod/worker.html">worker</a></code> the value must be greater or equal than
548        the sum of <code class="directive"><a href="#minsparethreads">MinSpareThreads</a></code>
549        and <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code>.</li>
550      </ul>
551    </div>
552
553<h3>See also</h3>
554<ul>
555<li><code class="directive"><a href="#minsparethreads">MinSpareThreads</a></code></li>
556<li><code class="directive"><a href="#startservers">StartServers</a></code></li>
557</ul>
558</div>
559<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
560<div class="directive-section"><h2><a name="MinSpareThreads" id="MinSpareThreads">MinSpareThreads</a> <a name="minsparethreads" id="minsparethreads">Directive</a></h2>
561<table class="directive">
562<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Minimum number of idle threads available to handle request
563spikes</td></tr>
564<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MinSpareThreads <var>number</var></code></td></tr>
565<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr>
566<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
567<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
568<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/mpmt_os2.html">mpmt_os2</a></code>, <code class="module"><a href="/mod/worker.html">worker</a></code></td></tr>
569</table>
570    <p>Minimum number of idle threads to handle request spikes.
571    Different MPMs deal with this directive
572    differently.</p>
573
574
575    <p><code class="module"><a href="/mod/worker.html">worker</a></code>
576     uses a default of <code>MinSpareThreads
577    75</code> and deal with idle threads on a server-wide basis. If
578    there aren't enough idle threads in the server then child
579    processes are created until the number of idle threads is greater
580    than number.</p>
581
582    <p><code class="module"><a href="/mod/mpm_netware.html">mpm_netware</a></code> uses a default of
583    <code>MinSpareThreads 10</code> and, since it is a single-process
584    MPM, tracks this on a server-wide bases.</p>
585
586    <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
587    similar to <code class="module"><a href="/mod/mpm_netware.html">mpm_netware</a></code>. The default for
588    <code class="module"><a href="/mod/beos.html">beos</a></code> is <code>MinSpareThreads 1</code>. For
589    <code class="module"><a href="/mod/mpmt_os2.html">mpmt_os2</a></code> the default value is <code>5</code>.</p>
590
591<h3>See also</h3>
592<ul>
593<li><code class="directive"><a href="#maxsparethreads">MaxSpareThreads</a></code></li>
594<li><code class="directive"><a href="#startservers">StartServers</a></code></li>
595</ul>
596</div>
597<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
598<div class="directive-section"><h2><a name="PidFile" id="PidFile">PidFile</a> <a name="pidfile" id="pidfile">Directive</a></h2>
599<table class="directive">
600<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>File where the server records the process ID
601of the daemon</td></tr>
602<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>PidFile <var>filename</var></code></td></tr>
603<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>PidFile logs/httpd.pid</code></td></tr>
604<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
605<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
606<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_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/prefork.html">prefork</a></code>, <code class="module"><a href="/mod/worker.html">worker</a></code></td></tr>
607</table>
608    <p>The <code class="directive">PidFile</code> directive sets the file to
609    which the server records the process id of the daemon. If the
610    filename is not absolute then it is assumed to be relative to the
611    <code class="directive"><a href="/mod/core.html#serverroot">ServerRoot</a></code>.</p>
612
613    <div class="example"><h3>Example</h3><p><code>
614      PidFile /var/run/apache.pid
615    </code></p></div>
616
617    <p>It is often useful to be able to send the server a signal,
618    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
619    re-reads its configuration files. This is done by sending a
620    SIGHUP (kill -1) signal to the process id listed in the
621    <code class="directive">PidFile</code>.</p>
622
623    <p>The <code class="directive">PidFile</code> is subject to the same
624    warnings about log file placement and <a href="/misc/security_tips.html#serverroot">security</a>.</p>
625
626    <div class="note"><h3>Note</h3>
627      <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>
628    </div>
629
630</div>
631<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
632<div class="directive-section"><h2><a name="ReceiveBufferSize" id="ReceiveBufferSize">ReceiveBufferSize</a> <a name="receivebuffersize" id="receivebuffersize">Directive</a></h2>
633<table class="directive">
634<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>TCP receive buffer size</td></tr>
635<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ReceiveBufferSize <var>bytes</var></code></td></tr>
636<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ReceiveBufferSize 0</code></td></tr>
637<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
638<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
639<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/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/prefork.html">prefork</a></code>, <code class="module"><a href="/mod/worker.html">worker</a></code></td></tr>
640</table>
641    <p>The server will set the TCP receive buffer size to the number of
642    bytes specified.</p>
643
644    <p>If set to the value of <code>0</code>, the server will use the
645    OS default.</p>
646
647</div>
648<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
649<div class="directive-section"><h2><a name="ScoreBoardFile" id="ScoreBoardFile">ScoreBoardFile</a> <a name="scoreboardfile" id="scoreboardfile">Directive</a></h2>
650<table class="directive">
651<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Location of the file used to store coordination data for
652the child processes</td></tr>
653<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ScoreBoardFile <var>file-path</var></code></td></tr>
654<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ScoreBoardFile logs/apache_runtime_status</code></td></tr>
655<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
656<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
657<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_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="/mod/prefork.html">prefork</a></code>, <code class="module"><a href="/mod/worker.html">worker</a></code></td></tr>
658</table>
659    <p>Apache uses a scoreboard to communicate between its parent
660    and child processes.  Some architectures require a file to facilitate
661    this communication. If the file is left unspecified, Apache first
662    attempts to create the scoreboard entirely in memory (using anonymous
663    shared memory) and, failing that, will attempt to create the file on
664    disk (using file-based shared memory). Specifying this directive causes
665    Apache to always create the file on the disk.</p>
666
667    <div class="example"><h3>Example</h3><p><code>
668      ScoreBoardFile /var/run/apache_runtime_status
669    </code></p></div>
670
671    <p>File-based shared memory is useful for third-party applications
672    that require direct access to the scoreboard.</p>
673
674    <p>If you use a <code class="directive">ScoreBoardFile</code> then
675    you may see improved speed by placing it on a RAM disk. But be
676    careful that you heed the same warnings about log file placement
677    and <a href="/misc/security_tips.html">security</a>.</p>
678
679<h3>See also</h3>
680<ul>
681<li><a href="/stopping.html">Stopping and Restarting
682Apache</a></li>
683</ul>
684</div>
685<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
686<div class="directive-section"><h2><a name="SendBufferSize" id="SendBufferSize">SendBufferSize</a> <a name="sendbuffersize" id="sendbuffersize">Directive</a></h2>
687<table class="directive">
688<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>TCP buffer size</td></tr>
689<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SendBufferSize <var>bytes</var></code></td></tr>
690<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>SendBufferSize 0</code></td></tr>
691<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
692<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
693<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/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/prefork.html">prefork</a></code>, <code class="module"><a href="/mod/worker.html">worker</a></code></td></tr>
694</table>
695    <p>The server will set the TCP send buffer size to the number of bytes
696    specified. Very useful to increase past standard OS defaults on
697    high speed high latency (<em>i.e.</em>, 100ms or so, such as
698    transcontinental fast pipes).</p>
699
700    <p>If set to the value of <code>0</code>, the server will use the
701    OS default.</p>
702
703    <p>Further configuration of your operating system may be required to elicit
704    better performance on high speed, high latency connections.</p>
705
706    <div class="note"> <p> On some operating systems, changes in TCP behavior resulting
707    from a larger <code class="directive">SendBufferSize</code> may not be seen unless
708    <code class="directive"><a href="/mod/core.html#enablesendfile">EnableSendfile</a></code> is set to OFF.  This
709    interaction applies only to static files.</p> </div>
710
711
712</div>
713<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
714<div class="directive-section"><h2><a name="ServerLimit" id="ServerLimit">ServerLimit</a> <a name="serverlimit" id="serverlimit">Directive</a></h2>
715<table class="directive">
716<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Upper limit on configurable number of processes</td></tr>
717<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerLimit <var>number</var></code></td></tr>
718<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr>
719<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
720<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
721<tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="/mod/prefork.html">prefork</a></code>, <code class="module"><a href="/mod/worker.html">worker</a></code></td></tr>
722</table>
723    <p>For the <code class="module"><a href="/mod/prefork.html">prefork</a></code> MPM, this directive sets the
724    maximum configured value for <code class="directive"><a href="#maxclients">MaxClients</a></code> for the lifetime of the
725    Apache process.  For the <code class="module"><a href="/mod/worker.html">worker</a></code> MPM, this directive
726    in combination with <code class="directive"><a href="#threadlimit">ThreadLimit</a></code> sets
727    the maximum configured value for <code class="directive"><a href="#maxclients">MaxClients</a></code> for the lifetime of the
728    Apache process.  Any attempts to change this directive during a
729    restart will be ignored, but <code class="directive"><a href="#maxclients">MaxClients</a></code> can be modified during
730    a restart.</p>
731
732    <p>Special care must be taken when using this directive.  If
733    <code class="directive">ServerLimit</code> is set to a value much higher
734    than necessary, extra, unused shared memory will be allocated.  If
735    both <code class="directive">ServerLimit</code> and <code class="directive"><a href="#maxclients">MaxClients</a></code> are set to values
736    higher than the system can handle, Apache may not start or the
737    system may become unstable.</p>
738
739    <p>With the <code class="module"><a href="/mod/prefork.html">prefork</a></code> MPM, use this directive only
740    if you need to set <code class="directive"><a href="#maxclients">MaxClients</a></code> higher than 256 (default).
741    Do not set the value of this directive any higher than what you
742    might want to set <code class="directive"><a href="#maxclients">MaxClients</a></code> to.</p>
743
744    <p>With <code class="module"><a href="/mod/worker.html">worker</a></code>
745     use this directive only
746    if your <code class="directive"><a href="#maxclients">MaxClients</a></code> and
747    <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code>
748    settings require more than 16 server processes (default). Do not set
749    the value of this directive any higher than the number of server
750    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>
751
752    <div class="note"><h3>Note</h3>
753      <p>There is a hard limit of <code>ServerLimit 20000</code> compiled
754      into the server (for the <code class="module"><a href="/mod/prefork.html">prefork</a></code> MPM 200000). This is
755      intended to avoid nasty effects caused by typos.</p>
756    </div>
757
758<h3>See also</h3>
759<ul>
760<li><a href="/stopping.html">Stopping and Restarting Apache</a></li>
761</ul>
762</div>
763<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
764<div class="directive-section"><h2><a name="StartServers" id="StartServers">StartServers</a> <a name="startservers" id="startservers">Directive</a></h2>
765<table class="directive">
766<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Number of child server processes created at startup</td></tr>
767<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>StartServers <var>number</var></code></td></tr>
768<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr>
769<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
770<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
771<tr><th><a href="directive-dict.html#Module">Module:</a></th><td><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/worker.html">worker</a></code></td></tr>
772</table>
773    <p>The <code class="directive">StartServers</code> directive sets the
774    number of child server processes created on startup. As the number
775    of processes is dynamically controlled depending on the load,
776    there is usually little reason to adjust this parameter.</p>
777
778    <p>The default value differs from MPM to MPM. For
779    <code class="module"><a href="/mod/worker.html">worker</a></code> the default is <code>StartServers 3</code>.
780    For <code class="module"><a href="/mod/prefork.html">prefork</a></code> defaults to <code>5</code> and for
781    <code class="module"><a href="/mod/mpmt_os2.html">mpmt_os2</a></code> to <code>2</code>.</p>
782
783</div>
784<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
785<div class="directive-section"><h2><a name="StartThreads" id="StartThreads">StartThreads</a> <a name="startthreads" id="startthreads">Directive</a></h2>
786<table class="directive">
787<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Number of threads created on startup</td></tr>
788<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>StartThreads <var>number</var></code></td></tr>
789<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr>
790<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
791<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
792<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></td></tr>
793</table>
794    <p>Number of threads created on startup. As the
795    number of threads is dynamically controlled depending on the
796    load, there is usually little reason to adjust this
797    parameter.</p>
798
799    <p>For <code class="module"><a href="/mod/mpm_netware.html">mpm_netware</a></code> the default is
800    <code>StartThreads 50</code> and, since there is only a single
801    process, this is the total number of threads created at startup to
802    serve requests.</p>
803
804    <p>For <code class="module"><a href="/mod/beos.html">beos</a></code> the default is <code>StartThreads
805    10</code>. It also reflects the total number of threads created
806    at startup to serve requests.</p>
807
808</div>
809<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
810<div class="directive-section"><h2><a name="ThreadLimit" id="ThreadLimit">ThreadLimit</a> <a name="threadlimit" id="threadlimit">Directive</a></h2>
811<table class="directive">
812<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets the upper limit on the configurable number of threads
813per child process</td></tr>
814<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ThreadLimit <var>number</var></code></td></tr>
815<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr>
816<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
817<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
818<tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="/mod/mpm_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="/mod/worker.html">worker</a></code></td></tr>
819<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
820and later</td></tr>
821</table>
822    <p>This directive sets the maximum configured value for <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code> for the lifetime
823    of the Apache process.  Any attempts to change this directive
824    during a restart will be ignored, but <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code> can be modified
825    during a restart up to the value of this directive.</p>
826
827    <p>Special care must be taken when using this directive.  If
828    <code class="directive">ThreadLimit</code> is set to a value much higher
829    than <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code>,
830    extra unused shared memory will be allocated.  If both
831    <code class="directive">ThreadLimit</code> and <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code> are set to values
832    higher than the system can handle, Apache may not start or the
833    system may become unstable. Do not set the value of this directive
834    any higher than your greatest predicted setting of <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code> for the
835    current run of Apache.</p>
836
837    <p>The default value for <code class="directive">ThreadLimit</code> is
838    <code>1920</code> when used with <code class="module"><a href="/mod/mpm_winnt.html">mpm_winnt</a></code> and
839    <code>64</code> when used with the others.</p>
840
841    <div class="note"><h3>Note</h3>
842      <p>There is a hard limit of <code>ThreadLimit 20000</code> (or
843      <code>ThreadLimit 15000</code> with <code class="module"><a href="/mod/mpm_winnt.html">mpm_winnt</a></code>)
844      compiled into the server. This is intended to avoid nasty effects
845      caused by typos.</p>
846    </div>
847
848</div>
849<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
850<div class="directive-section"><h2><a name="ThreadsPerChild" id="ThreadsPerChild">ThreadsPerChild</a> <a name="threadsperchild" id="threadsperchild">Directive</a></h2>
851<table class="directive">
852<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Number of threads created by each child process</td></tr>
853<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ThreadsPerChild <var>number</var></code></td></tr>
854<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr>
855<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
856<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
857<tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="/mod/mpm_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="/mod/worker.html">worker</a></code></td></tr>
858</table>
859    <p>This directive sets the number of threads created by each
860    child process. The child creates these threads at startup and
861    never creates more. If using an MPM like <code class="module"><a href="/mod/mpm_winnt.html">mpm_winnt</a></code>,
862    where there is only one child process, this number should be high
863    enough to handle the entire load of the server. If using an MPM
864    like <code class="module"><a href="/mod/worker.html">worker</a></code>, where there are multiple child processes,
865    the <em>total</em> number of threads should be high enough to handle
866    the common load on the server.</p>
867
868    <p>The default value for <code class="directive">ThreadsPerChild</code> is
869    <code>64</code> when used with <code class="module"><a href="/mod/mpm_winnt.html">mpm_winnt</a></code> and
870    <code>25</code> when used with the others.</p>
871
872</div>
873<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
874<div class="directive-section"><h2><a name="ThreadStackSize" id="ThreadStackSize">ThreadStackSize</a> <a name="threadstacksize" id="threadstacksize">Directive</a></h2>
875<table class="directive">
876<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>The size in bytes of the stack used by threads handling 
877client connections</td></tr>
878<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ThreadStackSize <var>size</var></code></td></tr>
879<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>65536 on NetWare; varies on other operating systems</code></td></tr>
880<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
881<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
882<tr><th><a href="directive-dict.html#Module">Module:</a></th><td><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/worker.html">worker</a></code>, <code class="module"><a href="/mod/event.html">event</a></code></td></tr>
883<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.1 and later</td></tr>
884</table>
885    <p>The <code class="directive">ThreadStackSize</code> directive sets the 
886    size of the stack (for autodata) of threads which handle client
887    connections and call modules to help process those connections.  
888    In most cases the operating system default for stack size is 
889    reasonable, but there are some conditions where it may need to be 
890    adjusted:</p>
891
892    <ul>
893      <li>On platforms with a relatively small default thread stack size
894      (e.g., HP-UX), Apache may crash when using some third-party modules
895      which use a relatively large amount of autodata storage.  Those
896      same modules may have worked fine on other platforms where the
897      default thread stack size is larger.  This type of crash is
898      resolved by setting <code class="directive">ThreadStackSize</code> to a 
899      value higher than the operating system default.  This type of 
900      adjustment is necessary only if the provider of the third-party 
901      module specifies that it is required, or if diagnosis of an Apache 
902      crash indicates that the thread stack size was too small.</li>
903
904      <li>On platforms where the default thread stack size is 
905      significantly larger than necessary for the web server
906      configuration, a higher number of threads per child process
907      will be achievable if <code class="directive">ThreadStackSize</code> is
908      set to a value lower than the operating system default.  This type
909      of adjustment should only be made in a test environment which allows
910      the full set of web server processing can be exercised, as there
911      may be infrequent requests which require more stack to process.
912      The minimum required stack size strongly depends on the modules
913      used, but any change in the web server configuration can invalidate
914      the current <code class="directive">ThreadStackSize</code> setting.</li>
915    </ul>
916
917    <div class="note">It is recommended to not reduce <code class="directive">ThreadStackSize</code>
918    unless a high number of threads per child process is needed. On some
919    platforms (including Linux), a setting of 128000 is already too low and
920    causes crashes with some common modules.</div>
921
922</div>
923<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
924<div class="directive-section"><h2><a name="User" id="User">User</a> <a name="user" id="user">Directive</a></h2>
925<table class="directive">
926<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>The userid under which the server will answer
927requests</td></tr>
928<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>User <var>unix-userid</var></code></td></tr>
929<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>User #-1</code></td></tr>
930<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
931<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
932<tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="/mod/prefork.html">prefork</a></code>, <code class="module"><a href="/mod/worker.html">worker</a></code></td></tr>
933<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Only valid in global server config since Apache
9342.0</td></tr>
935</table>
936    <p>The <code class="directive">User</code> directive sets the user ID as
937    which the server will answer requests. In order to use this
938    directive, the server must be run initially as <code>root</code>.
939    If you start the server as a non-root user, it will fail to change
940    to the lesser privileged user, and will instead continue to run as
941    that original user. If you do start the server as <code>root</code>,
942    then it is normal for the parent process to remain running as root.
943    <var>Unix-userid</var> is one of:</p>
944
945    <dl>
946      <dt>A username</dt>
947      <dd>Refers to the given user by name.</dd>
948
949      <dt># followed by a user number.</dt>
950      <dd>Refers to a user by its number.</dd>
951    </dl>
952
953    <p>The user should have no privileges that result in it being
954    able to access files that are not intended to be visible to the
955    outside world, and similarly, the user should not be able to
956    execute code that is not meant for HTTP requests. It is
957    recommended that you set up a new user and group specifically for
958    running the server. Some admins use user <code>nobody</code>, but
959    this is not always desirable, since the <code>nobody</code> user
960    can have other uses on the system.</p>
961
962    <div class="warning"><h3>Security</h3>
963      <p>Don't set <code class="directive">User</code> (or <code class="directive"><a href="#group">Group</a></code>) to <code>root</code> unless
964      you know exactly what you are doing, and what the dangers are.</p>
965    </div>
966
967    <p>Special note: Use of this directive in <code class="directive"><a href="/mod/core.html#virtualhost">&lt;VirtualHost&gt;</a></code> is no longer supported. To
968    configure your server for <code class="program"><a href="/programs/suexec.html">suexec</a></code> use
969    <code class="directive"><a href="/mod/mod_suexec.html#suexecusergroup">SuexecUserGroup</a></code>.</p>
970
971    <div class="note"><h3>Note</h3>
972      <p>Although the <code class="directive">User</code> directive is present
973      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,
974      it is actually a no-op there and only exists for compatibility
975      reasons.</p>
976    </div>
977
978</div>
979</div>
980<div class="bottomlang">
981<p><span>Available Languages: </span><a href="/de/mod/mpm_common.html" hreflang="de" rel="alternate" title="Deutsch">&nbsp;de&nbsp;</a> |
982<a href="/en/mod/mpm_common.html" title="English">&nbsp;en&nbsp;</a> |
983<a href="/ja/mod/mpm_common.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a> |
984<a href="/tr/mod/mpm_common.html" hreflang="tr" rel="alternate" title="T�rk�e">&nbsp;tr&nbsp;</a></p>
985</div><div class="top"><a href="#page-header"><img src="/images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&amp;A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div>
986<script type="text/javascript"><!--//--><![CDATA[//><!--
987var comments_shortname = 'httpd';
988var comments_identifier = 'http://httpd.apache.org/docs/2.2/mod/mpm_common.html';
989(function(w, d) {
990    if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
991        d.write('<div id="comments_thread"><\/div>');
992        var s = d.createElement('script');
993        s.type = 'text/javascript';
994        s.async = true;
995        s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
996        (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
997    }
998    else { 
999        d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
1000    }
1001})(window, document);
1002//--><!]]></script></div><div id="footer">
1003<p class="apache">Copyright 2013 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>
1004<p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!--
1005if (typeof(prettyPrint) !== 'undefined') {
1006    prettyPrint();
1007}
1008//--><!]]></script>
1009</body></html>