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