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