2 <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
3 <?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
4 <!-- $LastChangedRevision$ -->
7 Licensed to the Apache Software Foundation (ASF) under one or more
8 contributor license agreements. See the NOTICE file distributed with
9 this work for additional information regarding copyright ownership.
10 The ASF licenses this file to You under the Apache License, Version 2.0
11 (the "License"); you may not use this file except in compliance with
12 the License. You may obtain a copy of the License at
14 http://www.apache.org/licenses/LICENSE-2.0
16 Unless required by applicable law or agreed to in writing, software
17 distributed under the License is distributed on an "AS IS" BASIS,
18 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 See the License for the specific language governing permissions and
20 limitations under the License.
23 <modulesynopsis metafile="mpm_common.xml.meta">
25 <name>mpm_common</name>
26 <description>A collection of directives that are implemented by
27 more than one multi-processing module (MPM)</description>
31 <name>AcceptMutex</name>
32 <description>Method that Apache uses to serialize multiple children
33 accepting requests on network sockets</description>
34 <syntax>AcceptMutex Default|<var>method</var></syntax>
35 <default>AcceptMutex Default</default>
36 <contextlist><context>server config</context></contextlist>
37 <modulelist><module>leader</module><module>perchild</module>
38 <module>prefork</module><module>threadpool</module><module>worker</module>
42 <p>The <directive>AcceptMutex</directive> directives sets the
43 method that Apache uses to serialize multiple children accepting
44 requests on network sockets. Prior to Apache 2.0, the method was
45 selectable only at compile time. The optimal method to use is
46 highly architecture and platform dependent. For further details,
47 see the <a href="../misc/perf-tuning.html">performance tuning</a>
50 <p>If this directive is set to <code>Default</code>, then the
51 compile-time selected default will be used. Other possible
52 methods are listed below. Note that not all methods are
53 available on all platforms. If a method is specified which is
54 not available, a message will be written to the error log
55 listing the available methods.</p>
58 <dt><code>flock</code></dt>
59 <dd>uses the <code>flock(2)</code> system call to lock the
60 file defined by the <directive module="mpm_common"
61 >LockFile</directive> directive.</dd>
63 <dt><code>fcntl</code></dt>
64 <dd>uses the <code>fcntl(2)</code> system call to lock the
65 file defined by the <directive module="mpm_common"
66 >LockFile</directive> directive.</dd>
68 <dt><code>posixsem</code></dt>
69 <dd>uses POSIX compatible semaphores to implement the mutex.</dd>
71 <dt><code>pthread</code></dt>
72 <dd>uses POSIX mutexes as implemented by the POSIX Threads
73 (PThreads) specification.</dd>
75 <dt><code>sysvsem</code></dt>
76 <dd>uses SySV-style semaphores to implement the mutex.</dd>
79 <p>If you want to find out the compile time chosen default
80 for your system, you may set your <directive module="core"
81 >LogLevel</directive> to <code>debug</code>. Then the default <directive
82 >AcceptMutex</directive> will be written into the <directive
83 module="core">ErrorLog</directive>.</p>
85 <note type="warning"><title>Warning</title>
86 <p>On most systems, when the <code>pthread</code> option
87 is selected, if a child process terminates abnormally
88 while holding the <code>AcceptCntl</code> mutex the
89 server will stop responding to requests. When this
90 occurs, the server will require a manual restart to
92 <p>Solaris is a notable exception as it provides a
93 mechanism, used by Apache, which usually allows the
94 mutex to be recovered after a child process terminates
95 abnormally while holding a mutex.</p>
96 <p>If your system implements the
97 <code>pthread_mutexattr_setrobust_np()</code> function,
98 you may be able to use the <code>pthread</code> option safely.</p>
104 <name>CoreDumpDirectory</name>
105 <description>Directory where Apache attempts to
106 switch before dumping core</description>
107 <syntax>CoreDumpDirectory <var>directory</var></syntax>
108 <default>See usage for the default setting</default>
109 <contextlist><context>server config</context></contextlist>
110 <modulelist><module>beos</module><module>leader</module>
111 <module>mpm_winnt</module><module>perchild</module><module>prefork</module>
112 <module>threadpool</module><module>worker</module></modulelist>
115 <p>This controls the directory to which Apache attempts to
116 switch before dumping core. The default is in the
117 <directive module="core">ServerRoot</directive> directory, however
118 since this should not be writable by the user the server runs
119 as, core dumps won't normally get written. If you want a core
120 dump for debugging, you can use this directive to place it in a
121 different location.</p>
123 <note><title>Core Dumps on Linux</title>
124 <p>If Apache starts as root and switches to another user, the
125 Linux kernel <em>disables</em> core dumps even if the directory is
126 writable for the process. Apache (2.0.46 and later) reenables core dumps
127 on Linux 2.4 and beyond, but only if you explicitly configure a <directive
128 >CoreDumpDirectory</directive>.</p>
134 <name>EnableExceptionHook</name>
135 <description>Enables a hook that runs exception handlers
136 after a crash</description>
137 <syntax>EnableExceptionHook On|Off</syntax>
138 <default>EnableExceptionHook Off</default>
139 <contextlist><context>server config</context></contextlist>
140 <modulelist><module>leader</module><module>perchild</module>
141 <module>prefork</module><module>threadpool</module>
142 <module>worker</module></modulelist>
143 <compatibility>Available in version 2.0.49 and later</compatibility>
146 <p>For safety reasons this directive is only available if the server was
147 configured with the <code>--enable-exception-hook</code> option. It
148 enables a hook that allows external modules to plug in and do something
149 after a child crashed.</p>
151 <p>There are already two modules, <code>mod_whatkilledus</code> and
152 <code>mod_backtrace</code> that make use of this hook. Please have a
153 look at Jeff Trawick's <a
154 href="http://www.apache.org/~trawick/exception_hook.html"
155 >EnableExceptionHook site</a> for more information about these.</p>
160 <name>GracefulShutdownTimeout</name>
161 <description>Specify a timeout after which a gracefully shutdown server
162 will exit.</description>
163 <syntax>GracefulShutDownTimeout <var>seconds</var></syntax>
164 <default>GracefulShutDownTimeout 0</default>
165 <contextlist><context>server config</context></contextlist>
166 <modulelist><module>prefork</module><module>worker</module>
167 <module>event</module></modulelist>
168 <compatibility>Available in version 2.2 and later</compatibility>
171 <p>The <directive>GracefulShutdownTimeout</directive> specifies
172 how many seconds after receiving a "graceful-stop" signal, a
173 server should continue to run, handling the existing connections.</p>
175 <p>Setting this value to zero means that the server will wait
176 indefinitely until all remaining requests have been fully served.</p>
182 <description>Group under which the server will answer
183 requests</description>
184 <syntax>Group <var>unix-group</var></syntax>
185 <default>Group #-1</default>
186 <contextlist><context>server config</context></contextlist>
187 <modulelist><module>beos</module><module>leader</module>
188 <module>mpmt_os2</module><module>perchild</module><module>prefork</module>
189 <module>threadpool</module><module>worker</module></modulelist>
190 <compatibility>Only valid in global server config since Apache
194 <p>The <directive>Group</directive> directive sets the group under
195 which the server will answer requests. In order to use this
196 directive, the server must be run initially as <code>root</code>. If
197 you start the server as a non-root user, it will fail to change to the
198 specified group, and will instead continue to run as the group of the
199 original user. <var>Unix-group</var> is one of:</p>
202 <dt>A group name</dt>
203 <dd>Refers to the given group by name.</dd>
205 <dt><code>#</code> followed by a group number.</dt>
206 <dd>Refers to a group by its number.</dd>
209 <example><title>Example</title>
213 <p>It is recommended that you set up a new group specifically for
214 running the server. Some admins use user <code>nobody</code>,
215 but this is not always possible or desirable.</p>
217 <note type="warning"><title>Security</title>
218 <p>Don't set <directive>Group</directive> (or <directive
219 module="mpm_common">User</directive>) to <code>root</code> unless
220 you know exactly what you are doing, and what the dangers are.</p>
223 <p>Special note: Use of this directive in <directive module="core"
224 type="section">VirtualHost</directive> is no longer supported. To
225 configure your server for <program>suexec</program> use
226 <directive module="mod_suexec">SuexecUserGroup</directive>.</p>
228 <note><title>Note</title>
229 <p>Although the <directive>Group</directive> directive is present
230 in the <module>beos</module> and <module>mpmt_os2</module> MPMs,
231 it is actually a no-op there and only exists for compatibility
239 <description>File where the server records the process ID
240 of the daemon</description>
241 <syntax>PidFile <var>filename</var></syntax>
242 <default>PidFile logs/httpd.pid</default>
243 <contextlist><context>server config</context></contextlist>
244 <modulelist><module>beos</module><module>leader</module>
245 <module>mpm_winnt</module><module>mpmt_os2</module>
246 <module>perchild</module><module>prefork</module>
247 <module>threadpool</module><module>worker</module></modulelist>
250 <p>The <directive>PidFile</directive> directive sets the file to
251 which the server records the process id of the daemon. If the
252 filename is not absolute then it is assumed to be relative to the
253 <directive module="core">ServerRoot</directive>.</p>
255 <example><title>Example</title>
256 PidFile /var/run/apache.pid
259 <p>It is often useful to be able to send the server a signal,
260 so that it closes and then re-opens its <directive
261 module="core">ErrorLog</directive> and <directive
262 module="mod_log_config">TransferLog</directive>, and
263 re-reads its configuration files. This is done by sending a
264 SIGHUP (kill -1) signal to the process id listed in the
265 <directive>PidFile</directive>.</p>
267 <p>The <directive>PidFile</directive> is subject to the same
268 warnings about log file placement and <a
269 href="../misc/security_tips.html#serverroot">security</a>.</p>
271 <note><title>Note</title>
272 <p>As of Apache 2 it is recommended to use only the <program>
273 apachectl</program> script for (re-)starting or stopping the server.</p>
280 <description>IP addresses and ports that the server
281 listens to</description>
282 <syntax>Listen [<var>IP-address</var>:]<var>portnumber</var> [<var>protocol</var>]</syntax>
283 <contextlist><context>server config</context></contextlist>
284 <modulelist><module>beos</module><module>leader</module>
285 <module>mpm_netware</module><module>mpm_winnt</module>
286 <module>mpmt_os2</module><module>perchild</module>
287 <module>prefork</module><module>threadpool</module><module>worker</module>
288 <module>event</module>
290 <compatibility>Required directive since Apache 2.0<br/>
291 The <var>protocol</var> argument was added in 2.1.5</compatibility>
294 <p>The <directive>Listen</directive> directive instructs Apache to
295 listen to only specific IP addresses or ports; by default it
296 responds to requests on all IP interfaces. <directive>Listen</directive>
297 is now a required directive. If it is not in the config file, the
298 server will fail to start. This is a change from previous versions
301 <p>The <directive>Listen</directive> directive tells the server to
302 accept incoming requests on the specified port or address-and-port
303 combination. If only a port number is specified, the server listens to
304 the given port on all interfaces. If an IP address is given as well
305 as a port, the server will listen on the given port and
308 <p>Multiple <directive>Listen</directive> directives may be used to
309 specify a number of addresses and ports to listen to. The server will
310 respond to requests from any of the listed addresses and ports.</p>
312 <p>For example, to make the server accept connections on both
313 port 80 and port 8000, use:</p>
320 <p>To make the server accept connections on two specified
321 interfaces and port numbers, use </p>
324 Listen 192.170.2.1:80<br />
325 Listen 192.170.2.5:8000
328 <p>IPv6 addresses must be surrounded in square brackets, as in the
329 following example:</p>
332 Listen [2001:db8::a00:20ff:fea7:ccea]:80
335 <p>The optional <var>protocol</var> argument is not required for most
336 configurations. If not specified, <code>https</code> is the default for
337 port 443 and <code>http</code> the default for all other ports. The
338 protocol is used to determine which module should handle a request, and
339 to apply protocol specific optimizations with the
340 <directive module="core">AcceptFilter</directive> directive.</p>
342 <p>You only need to set the protocol if you are running on non-standard
343 ports. For example, running an <code>https</code> site on port 8443:</p>
346 Listen 192.170.2.1:8443 https
349 <note><title>Error condition</title>
350 Multiple <directive>Listen</directive> directives for the same ip
351 address and port will result in an <code>Address already in use</code>
356 <seealso><a href="../dns-caveats.html">DNS Issues</a></seealso>
357 <seealso><a href="../bind.html">Setting which addresses and ports Apache
362 <name>ListenBackLog</name>
363 <description>Maximum length of the queue of pending connections</description>
364 <syntax>ListenBacklog <var>backlog</var></syntax>
365 <default>ListenBacklog 511</default>
366 <contextlist><context>server config</context></contextlist>
367 <modulelist><module>beos</module><module>leader</module>
368 <module>mpm_netware</module><module>mpm_winnt</module>
369 <module>mpmt_os2</module><module>perchild</module><module>prefork</module>
370 <module>threadpool</module><module>worker</module></modulelist>
373 <p>The maximum length of the queue of pending connections.
374 Generally no tuning is needed or desired, however on some
375 systems it is desirable to increase this when under a TCP SYN
376 flood attack. See the backlog parameter to the
377 <code>listen(2)</code> system call.</p>
379 <p>This will often be limited to a smaller number by the
380 operating system. This varies from OS to OS. Also note that
381 many OSes do not use exactly what is specified as the backlog,
382 but use a number based on (but normally larger than) what is
388 <name>LockFile</name>
389 <description>Location of the accept serialization lock file</description>
390 <syntax>LockFile <var>filename</var></syntax>
391 <default>LockFile logs/accept.lock</default>
392 <contextlist><context>server config</context></contextlist>
393 <modulelist><module>leader</module><module>perchild</module>
394 <module>prefork</module><module>threadpool</module><module>worker</module>
398 <p>The <directive>LockFile</directive> directive sets the path to
399 the lockfile used when Apache is used with an <directive
400 module="mpm_common">AcceptMutex</directive> value of either
401 <code>fcntl</code> or <code>flock</code>. This directive should
402 normally be left at its default value. The main reason for changing
403 it is if the <code>logs</code> directory is NFS mounted, since
404 <strong>the lockfile must be stored on a local disk</strong>. The PID
405 of the main server process is automatically appended to the
408 <note type="warning"><title>Security</title>
409 <p>It is best to <em>avoid</em> putting this file in a world writable
410 directory such as <code>/var/tmp</code> because someone could create
411 a denial of service attack and prevent the server from starting by
412 creating a lockfile with the same name as the one the server will try
416 <seealso><directive module="mpm_common">AcceptMutex</directive></seealso>
420 <name>MaxClients</name>
421 <description>Maximum number of child processes that will be created
422 to serve requests</description>
423 <syntax>MaxClients <var>number</var></syntax>
424 <default>See usage for details</default>
425 <contextlist><context>server config</context></contextlist>
426 <modulelist><module>beos</module><module>leader</module>
427 <module>prefork</module><module>threadpool</module><module>worker</module>
431 <p>The <directive>MaxClients</directive> directive sets the limit
432 on the number of simultaneous requests that will be served. Any
433 connection attempts over the <directive>MaxClients</directive>
434 limit will normally be queued, up to a number based on the
435 <directive module="mpm_common">ListenBacklog</directive>
436 directive. Once a child process is freed at the end of a different
437 request, the connection will then be serviced.</p>
439 <p>For non-threaded servers (<em>i.e.</em>, <module>prefork</module>),
440 <directive>MaxClients</directive> translates into the maximum
441 number of child processes that will be launched to serve requests.
442 The default value is <code>256</code>; to increase it, you must also raise
443 <directive module="mpm_common">ServerLimit</directive>.</p>
445 <p>For threaded and hybrid servers (<em>e.g.</em> <module>beos</module>
446 or <module>worker</module>) <directive>MaxClients</directive> restricts
447 the total number of threads that will be available to serve clients.
448 The default value for <module>beos</module> is <code>50</code>. For
449 hybrid MPMs the default value is <code>16</code> (<directive
450 module="mpm_common">ServerLimit</directive>) multiplied by the value of
451 <code>25</code> (<directive module="mpm_common"
452 >ThreadsPerChild</directive>). Therefore, to increase <directive
453 >MaxClients</directive> to a value that requires more than 16 processes,
454 you must also raise <directive module="mpm_common"
455 >ServerLimit</directive>.</p>
460 <name>MaxMemFree</name>
461 <description>Maximum amount of memory that the main allocator is allowed
462 to hold without calling <code>free()</code></description>
463 <syntax>MaxMemFree <var>KBytes</var></syntax>
464 <default>MaxMemFree 0</default>
465 <contextlist><context>server config</context></contextlist>
466 <modulelist><module>beos</module><module>leader</module>
467 <module>mpm_netware</module><module>prefork</module>
468 <module>threadpool</module><module>worker</module><module>mpm_winnt</module></modulelist>
471 <p>The <directive>MaxMemFree</directive> directive sets the
472 maximum number of free Kbytes that the main allocator is allowed
473 to hold without calling <code>free()</code>. When not set, or when set
474 to zero, the threshold will be set to unlimited.</p>
479 <name>MaxRequestsPerChild</name>
480 <description>Limit on the number of requests that an individual child server
481 will handle during its life</description>
482 <syntax>MaxRequestsPerChild <var>number</var></syntax>
483 <default>MaxRequestsPerChild 10000</default>
484 <contextlist><context>server config</context></contextlist>
485 <modulelist><module>leader</module><module>mpm_netware</module>
486 <module>mpm_winnt</module><module>mpmt_os2</module>
487 <module>perchild</module><module>prefork</module>
488 <module>threadpool</module><module>worker</module></modulelist>
491 <p>The <directive>MaxRequestsPerChild</directive> directive sets
492 the limit on the number of requests that an individual child
493 server process will handle. After
494 <directive>MaxRequestsPerChild</directive> requests, the child
495 process will die. If <directive>MaxRequestsPerChild</directive> is
496 <code>0</code>, then the process will never expire.</p>
498 <note><title>Different default values</title>
499 <p>The default value for <module>mpm_netware</module> and
500 <module>mpm_winnt</module> is <code>0</code>.</p>
503 <p>Setting <directive>MaxRequestsPerChild</directive> to a
504 non-zero limit has two beneficial effects:</p>
507 <li>it limits the amount of memory that process can consume
508 by (accidental) memory leakage;</li>
510 <li>by giving processes a finite lifetime, it helps reduce
511 the number of processes when the server load reduces.</li>
514 <note><title>Note</title>
515 <p>For <directive module="core">KeepAlive</directive> requests, only
516 the first request is counted towards this limit. In effect, it
517 changes the behavior to limit the number of <em>connections</em> per
524 <name>MaxSpareThreads</name>
525 <description>Maximum number of idle threads</description>
526 <syntax>MaxSpareThreads <var>number</var></syntax>
527 <default>See usage for details</default>
528 <contextlist><context>server config</context></contextlist>
529 <modulelist><module>beos</module><module>leader</module>
530 <module>mpm_netware</module><module>mpmt_os2</module>
531 <module>perchild</module><module>threadpool</module><module>worker</module>
535 <p>Maximum number of idle threads. Different MPMs deal with this
536 directive differently.</p>
538 <p>For <module>perchild</module> the default is
539 <code>MaxSpareThreads 10</code>. This MPM monitors the number of
540 idle threads on a per-child basis. If there are too many idle
541 threads in that child, the server will begin to kill threads
542 within that child.</p>
544 <p>For <module>worker</module>, <module>leader</module> and <module
545 >threadpool</module> the default is <code>MaxSpareThreads 250</code>.
546 These MPMs deal with idle threads on a server-wide basis. If there
547 are too many idle threads in the server then child processes are
548 killed until the number of idle threads is less than this number.</p>
550 <p>For <module>mpm_netware</module> the default is
551 <code>MaxSpareThreads 100</code>. Since this MPM runs a
552 single-process, the spare thread count is also server-wide.</p>
554 <p><module>beos</module> and <module>mpmt_os2</module> work
555 similar to <module>mpm_netware</module>. The default for
556 <module>beos</module> is <code>MaxSpareThreads 50</code>. For
557 <module>mpmt_os2</module> the default value is <code>10</code>.</p>
559 <note><title>Restrictions</title>
560 <p>The range of the <directive>MaxSpareThreads</directive> value
561 is restricted. Apache will correct the given value automatically
562 according to the following rules:</p>
564 <li><module>perchild</module> requires <directive
565 >MaxSpareThreads</directive> to be less or equal than <directive
566 module="mpm_common">ThreadLimit</directive>.</li>
568 <li><module>mpm_netware</module> wants the value to be greater than
569 <directive module="mpm_common">MinSpareThreads</directive>.</li>
571 <li>For <module>leader</module>, <module>threadpool</module> and
572 <module>worker</module> the value must be greater or equal than
573 the sum of <directive module="mpm_common">MinSpareThreads</directive>
574 and <directive module="mpm_common">ThreadsPerChild</directive>.</li>
578 <seealso><directive module="mpm_common">MinSpareThreads</directive></seealso>
579 <seealso><directive module="mpm_common">StartServers</directive></seealso>
583 <name>MinSpareThreads</name>
584 <description>Minimum number of idle threads available to handle request
586 <syntax>MinSpareThreads <var>number</var></syntax>
587 <default>See usage for details</default>
588 <contextlist><context>server config</context></contextlist>
589 <modulelist><module>beos</module><module>leader</module>
590 <module>mpm_netware</module><module>mpmt_os2</module>
591 <module>perchild</module><module>threadpool</module><module>worker</module>
595 <p>Minimum number of idle threads to handle request spikes.
596 Different MPMs deal with this directive
599 <p><module>perchild</module> uses a default of
600 <code>MinSpareThreads 5</code> and monitors the number of idle
601 threads on a per-child basis. If there aren't enough idle threads
602 in that child, the server will begin to create new threads within
603 that child. Thus, if you set <directive module="perchild"
604 >NumServers</directive> to <code>10</code> and a <directive
605 >MinSpareThreads</directive> value of <code>5</code>, you'll have
606 at least 50 idle threads on your system.</p>
608 <p><module>worker</module>, <module>leader</module> and
609 <module>threadpool</module> use a default of <code>MinSpareThreads
610 75</code> and deal with idle threads on a server-wide basis. If
611 there aren't enough idle threads in the server then child
612 processes are created until the number of idle threads is greater
615 <p><module>mpm_netware</module> uses a default of
616 <code>MinSpareThreads 10</code> and, since it is a single-process
617 MPM, tracks this on a server-wide bases.</p>
619 <p><module>beos</module> and <module>mpmt_os2</module> work
620 similar to <module>mpm_netware</module>. The default for
621 <module>beos</module> is <code>MinSpareThreads 1</code>. For
622 <module>mpmt_os2</module> the default value is <code>5</code>.</p>
624 <seealso><directive module="mpm_common">MaxSpareThreads</directive></seealso>
625 <seealso><directive module="mpm_common">StartServers</directive></seealso>
629 <name>ScoreBoardFile</name>
630 <description>Location of the file used to store coordination data for
631 the child processes</description>
632 <syntax>ScoreBoardFile <var>file-path</var></syntax>
633 <default>ScoreBoardFile logs/apache_status</default>
634 <contextlist><context>server config</context></contextlist>
635 <modulelist><module>beos</module><module>leader</module>
636 <module>mpm_winnt</module><module>perchild</module><module>prefork</module>
637 <module>threadpool</module><module>worker</module></modulelist>
640 <p>Apache uses a scoreboard to communicate between its parent
641 and child processes. Some architectures require a file to facilitate
642 this communication. If the file is left unspecified, Apache first
643 attempts to create the scoreboard entirely in memory (using anonymous
644 shared memory) and, failing that, will attempt to create the file on
645 disk (using file-based shared memory). Specifying this directive causes
646 Apache to always create the file on the disk.</p>
648 <example><title>Example</title>
649 ScoreBoardFile /var/run/apache_status
652 <p>File-based shared memory is useful for third-party applications
653 that require direct access to the scoreboard.</p>
655 <p>If you use a <directive>ScoreBoardFile</directive> then
656 you may see improved speed by placing it on a RAM disk. But be
657 careful that you heed the same warnings about log file placement
658 and <a href="../misc/security_tips.html">security</a>.</p>
660 <seealso><a href="../stopping.html">Stopping and Restarting
665 <name>ReceiveBufferSize</name>
666 <description>TCP receive buffer size</description>
667 <syntax>ReceiveBufferSize <var>bytes</var></syntax>
668 <default>ReceiveBufferSize 0</default>
669 <contextlist><context>server config</context></contextlist>
670 <modulelist><module>beos</module><module>leader</module>
671 <module>mpm_netware</module><module>mpm_winnt</module>
672 <module>mpmt_os2</module><module>perchild</module><module>prefork</module>
673 <module>threadpool</module><module>worker</module></modulelist>
676 <p>The server will set the TCP receive buffer size to the number of
679 <p>If set to the value of <code>0</code>, the server will use the
685 <name>SendBufferSize</name>
686 <description>TCP buffer size</description>
687 <syntax>SendBufferSize <var>bytes</var></syntax>
688 <default>SendBufferSize 0</default>
689 <contextlist><context>server config</context></contextlist>
690 <modulelist><module>beos</module><module>leader</module>
691 <module>mpm_netware</module><module>mpm_winnt</module>
692 <module>mpmt_os2</module><module>perchild</module><module>prefork</module>
693 <module>threadpool</module><module>worker</module></modulelist>
696 <p>The server will set the TCP send buffer size to the number of bytes
697 specified. Very useful to increase past standard OS defaults on
698 high speed high latency (<em>i.e.</em>, 100ms or so, such as
699 transcontinental fast pipes).</p>
701 <p>If set to the value of <code>0</code>, the server will use the
707 <name>ServerLimit</name>
708 <description>Upper limit on configurable number of processes</description>
709 <syntax>ServerLimit <var>number</var></syntax>
710 <default>See usage for details</default>
711 <contextlist><context>server config</context></contextlist>
712 <modulelist><module>leader</module><module>perchild</module>
713 <module>prefork</module><module>threadpool</module><module>worker</module>
717 <p>For the <module>prefork</module> MPM, this directive sets the
718 maximum configured value for <directive
719 module="mpm_common">MaxClients</directive> for the lifetime of the
720 Apache process. For the <module>worker</module> MPM, this directive
721 in combination with <directive
722 module="mpm_common">ThreadLimit</directive> sets
723 the maximum configured value for <directive
724 module="mpm_common">MaxClients</directive> for the lifetime of the
725 Apache process. Any attempts to change this directive during a
726 restart will be ignored, but <directive
727 module="mpm_common">MaxClients</directive> can be modified during
730 <p>Special care must be taken when using this directive. If
731 <directive>ServerLimit</directive> is set to a value much higher
732 than necessary, extra, unused shared memory will be allocated. If
733 both <directive>ServerLimit</directive> and <directive
734 module="mpm_common">MaxClients</directive> are set to values
735 higher than the system can handle, Apache may not start or the
736 system may become unstable.</p>
738 <p>With the <module>prefork</module> MPM, use this directive only
739 if you need to set <directive
740 module="mpm_common">MaxClients</directive> higher than 256 (default).
741 Do not set the value of this directive any higher than what you
742 might want to set <directive
743 module="mpm_common">MaxClients</directive> to.</p>
745 <p>With <module>worker</module>, <module>leader</module> and
746 <module>threadpool</module> use this directive only
747 if your <directive module="mpm_common">MaxClients</directive> and
748 <directive module="mpm_common">ThreadsPerChild</directive>
749 settings require more than 16 server processes (default). Do not set
750 the value of this directive any higher than the number of server
751 processes required by what you may want for <directive
752 module="mpm_common">MaxClients </directive> and <directive
753 module="mpm_common">ThreadsPerChild</directive>.</p>
755 <p>With the <module>perchild</module> MPM, use this directive only
756 if you need to set <directive
757 module="perchild">NumServers</directive> higher than 8 (default).</p>
759 <note><title>Note</title>
760 <p>There is a hard limit of <code>ServerLimit 20000</code> compiled
761 into the server (for the <module>prefork</module> MPM 200000). This is
762 intended to avoid nasty effects caused by typos.</p>
765 <seealso><a href="../stopping.html">Stopping and Restarting Apache</a></seealso>
769 <name>StartServers</name>
770 <description>Number of child server processes created at startup</description>
771 <syntax>StartServers <var>number</var></syntax>
772 <default>See usage for details</default>
773 <contextlist><context>server config</context></contextlist>
774 <modulelist><module>leader</module><module>mpmt_os2</module>
775 <module>prefork</module><module>threadpool</module><module>worker</module>
779 <p>The <directive>StartServers</directive> directive sets the
780 number of child server processes created on startup. As the number
781 of processes is dynamically controlled depending on the load,
782 there is usually little reason to adjust this parameter.</p>
784 <p>The default value differs from MPM to MPM. For
785 <module>leader</module>, <module>threadpool</module> and
786 <module>worker</module> the default is <code>StartServers 3</code>.
787 For <module>prefork</module> defaults to <code>5</code> and for
788 <module>mpmt_os2</module> to <code>2</code>.</p>
793 <name>StartThreads</name>
794 <description>Number of threads created on startup</description>
795 <syntax>StartThreads <var>number</var></syntax>
796 <default>See usage for details</default>
797 <contextlist><context>server config</context></contextlist>
798 <modulelist><module>beos</module><module>mpm_netware</module>
799 <module>perchild</module></modulelist>
802 <p>Number of threads created on startup. As the
803 number of threads is dynamically controlled depending on the
804 load, there is usually little reason to adjust this
807 <p>For <module>perchild</module> the default is <code>StartThreads
808 5</code> and this directive tracks the number of threads per
809 process at startup.</p>
811 <p>For <module>mpm_netware</module> the default is
812 <code>StartThreads 50</code> and, since there is only a single
813 process, this is the total number of threads created at startup to
816 <p>For <module>beos</module> the default is <code>StartThreads
817 10</code>. It also reflects the total number of threads created
818 at startup to serve requests.</p>
823 <name>ThreadLimit</name>
824 <description>Sets the upper limit on the configurable number of threads
825 per child process</description>
826 <syntax>ThreadLimit <var>number</var></syntax>
827 <default>See usage for details</default>
828 <contextlist><context>server config</context></contextlist>
829 <modulelist><module>leader</module><module>mpm_winnt</module>
830 <module>perchild</module><module>threadpool</module><module>worker</module>
832 <compatibility>Available for <module>mpm_winnt</module> in Apache 2.0.41
833 and later</compatibility>
836 <p>This directive sets the maximum configured value for <directive
837 module="mpm_common">ThreadsPerChild</directive> for the lifetime
838 of the Apache process. Any attempts to change this directive
839 during a restart will be ignored, but <directive
840 module="mpm_common">ThreadsPerChild</directive> can be modified
841 during a restart up to the value of this directive.</p>
843 <p>Special care must be taken when using this directive. If
844 <directive>ThreadLimit</directive> is set to a value much higher
845 than <directive module="mpm_common">ThreadsPerChild</directive>,
846 extra unused shared memory will be allocated. If both
847 <directive>ThreadLimit</directive> and <directive
848 module="mpm_common">ThreadsPerChild</directive> are set to values
849 higher than the system can handle, Apache may not start or the
850 system may become unstable. Do not set the value of this directive
851 any higher than your greatest predicted setting of <directive
852 module="mpm_common">ThreadsPerChild</directive> for the
853 current run of Apache.</p>
855 <p>The default value for <directive>ThreadLimit</directive> is
856 <code>1920</code> when used with <module>mpm_winnt</module> and
857 <code>64</code> when used with the others.</p>
859 <note><title>Note</title>
860 <p>There is a hard limit of <code>ThreadLimit 20000</code> (or
861 <code>ThreadLimit 15000</code> with <module>mpm_winnt</module>)
862 compiled into the server. This is intended to avoid nasty effects
869 <name>ThreadsPerChild</name>
870 <description>Number of threads created by each child process</description>
871 <syntax>ThreadsPerChild <var>number</var></syntax>
872 <default>See usage for details</default>
873 <contextlist><context>server config</context></contextlist>
874 <modulelist><module>leader</module><module>mpm_winnt</module>
875 <module>threadpool</module><module>worker</module></modulelist>
878 <p>This directive sets the number of threads created by each
879 child process. The child creates these threads at startup and
880 never creates more. If using an MPM like <module>mpm_winnt</module>,
881 where there is only one child process, this number should be high
882 enough to handle the entire load of the server. If using an MPM
883 like <module>worker</module>, where there are multiple child processes,
884 the <em>total</em> number of threads should be high enough to handle
885 the common load on the server.</p>
887 <p>The default value for <directive>ThreadsPerChild</directive> is
888 <code>64</code> when used with <module>mpm_winnt</module> and
889 <code>25</code> when used with the others.</p>
894 <name>ThreadStackSize</name>
895 <description>The size in bytes of the stack used by threads handling
896 client connections</description>
897 <syntax>ThreadStackSize <var>size</var></syntax>
898 <default>65536 on NetWare; varies on other operating systems</default>
899 <contextlist><context>server config</context></contextlist>
900 <modulelist><module>leader</module><module>mpm_netware</module>
901 <module>mpm_winnt</module><module>perchild</module>
902 <module>threadpool</module><module>worker</module>
904 <compatibility>Available in Apache 2.1 and later</compatibility>
907 <p>The <directive>ThreadStackSize</directive> directive sets the
908 size of the stack (for autodata) of threads which handle client
909 connections and call modules to help process those connections.
910 In most cases the operating system default for stack size is
911 reasonable, but there are some conditions where it may need to be
915 <li>On platforms with a relatively small default thread stack size
916 (e.g., HP-UX), Apache may crash when using some third-party modules
917 which use a relatively large amount of autodata storage. Those
918 same modules may have worked fine on other platforms where the
919 default thread stack size is larger. This type of crash is
920 resolved by setting <directive>ThreadStackSize</directive> to a
921 value higher than the operating system default. This type of
922 adjustment is necessary only if the provider of the third-party
923 module specifies that it is required, or if diagnosis of an Apache
924 crash indicates that the thread stack size was too small.</li>
926 <li>On platforms where the default thread stack size is
927 significantly larger than necessary for the web server
928 configuration, a higher number of threads per child process
929 will be achievable if <directive>ThreadStackSize</directive> is
930 set to a value lower than the operating system default. This type
931 of adjustment should only be made in a test environment which allows
932 the full set of web server processing can be exercised, as there
933 may be infrequent requests which require more stack to process.
934 A change in the web server configuration can invalidate the
935 current <directive>ThreadStackSize</directive> setting.</li>
942 <description>The userid under which the server will answer
943 requests</description>
944 <syntax>User <var>unix-userid</var></syntax>
945 <default>User #-1</default>
946 <contextlist><context>server config</context></contextlist>
947 <modulelist><module>leader</module><module>perchild</module>
948 <module>prefork</module><module>threadpool</module><module>worker</module>
950 <compatibility>Only valid in global server config since Apache
954 <p>The <directive>User</directive> directive sets the user ID as
955 which the server will answer requests. In order to use this
956 directive, the server must be run initially as <code>root</code>.
957 If you start the server as a non-root user, it will fail to change
958 to the lesser privileged user, and will instead continue to run as
959 that original user. If you do start the server as <code>root</code>,
960 then it is normal for the parent process to remain running as root.
961 <var>Unix-userid</var> is one of:</p>
965 <dd>Refers to the given user by name.</dd>
967 <dt># followed by a user number.</dt>
968 <dd>Refers to a user by its number.</dd>
971 <p>The user should have no privileges that result in it being
972 able to access files that are not intended to be visible to the
973 outside world, and similarly, the user should not be able to
974 execute code that is not meant for HTTP requests. It is
975 recommended that you set up a new user and group specifically for
976 running the server. Some admins use user <code>nobody</code>, but
977 this is not always desirable, since the <code>nobody</code> user
978 can have other uses on the system.</p>
980 <note type="warning"><title>Security</title>
981 <p>Don't set <directive>User</directive> (or <directive
982 module="mpm_common">Group</directive>) to <code>root</code> unless
983 you know exactly what you are doing, and what the dangers are.</p>
986 <p>With the <module>perchild</module> MPM, which is intended to
987 server virtual hosts run under different user IDs, the
988 <directive>User</directive> directive defines the user ID for the
989 main server and the fallback for <directive type="section"
990 module="core">VirtualHost</directive> sections without an
991 <directive module="perchild">AssignUserID</directive> directive.</p>
993 <p>Special note: Use of this directive in <directive module="core"
994 type="section">VirtualHost</directive> is no longer supported. To
995 configure your server for <program>suexec</program> use
996 <directive module="mod_suexec">SuexecUserGroup</directive>.</p>
998 <note><title>Note</title>
999 <p>Although the <directive>User</directive> directive is present
1000 in the <module>beos</module> and <module>mpmt_os2</module> MPMs,
1001 it is actually a no-op there and only exists for compatibility
1005 </directivesynopsis>