2 <?xml-stylesheet type="text/xsl" href="../style/manual.xsl"?>
5 <name>mpm_common</name>
6 <description>A collection of directives that are implemented by
7 more than one multi-processing module (MPM)</description>
11 <name>CoreDumpDirectory</name>
12 <description>Sets the directory where Apache attempts to
13 switch before dumping core</description>
14 <syntax>CoreDumpDirectory <em>directory</em></syntax>
15 <default>CoreDumpDirectory <em>ServerRoot</em></default>
16 <contextlist><context>server config</context></contextlist>
17 <modulelist><module>worker</module><module>perchild</module>
18 <module>prefork</module><module>mpm_winnt</module>
23 <p>This controls the directory to which Apache attempts to
24 switch before dumping core. The default is in the
25 <directive module="core">ServerRoot</directive> directory, however
26 since this should not be writable by the user the server runs
27 as, core dumps won't normally get written. If you want a core
28 dump for debugging, you can use this directive to place it in a
29 different location.</p>
35 <description>Sets the group under which the server will answer
36 requests</description>
37 <syntax>Group <em>unix-group</em></syntax>
38 <default>Group #-1</default>
39 <contextlist><context>server config</context><context>virtual host</context>
41 <modulelist><module>worker</module><module>perchild</module>
42 <module>prefork</module></modulelist>
45 <p>The <directive>Group</directive> directive sets the group under
46 which the server will answer requests. In order to use this
47 directive, the stand-alone server must be run initially as root.
48 <em>Unix-group</em> is one of:</p>
53 <dd>Refers to the given group by name.</dd>
55 <dt># followed by a group number.</dt>
57 <dd>Refers to a group by its number.</dd>
59 <p>It is recommended that you set up a new group specifically for
60 running the server. Some admins use user <code>nobody</code>,
61 but this is not always possible or desirable.</p>
63 <p>Note: if you start the server as a non-root user, it will
64 fail to change to the specified group, and will instead
65 continue to run as the group of the original user.</p>
67 <p>Special note: Use of this directive in <VirtualHost< is
68 no longer supported. To implement the <a
69 href="../suexec.html">suEXEC wrapper</a> with Apache 2.0, use the
70 <directive module="mod_suexec">SuexecUserGroup</directive>
71 directive. SECURITY: See <directive
72 module="mpm_common">User</directive> for a discussion of the
73 security considerations.</p>
79 <description>Sets the file where the server records the process ID
80 of the daemon</description>
81 <syntax>PidFile <em>filename</em></syntax>
82 <default>PidFile logs/httpd.pid</default>
83 <contextlist><context>server config</context></contextlist>
84 <modulelist><module>worker</module><module>perchilde</module>
85 <module>prefork</module><module>mpm_winnt</module>
89 <p>The <directive>PidFile</directive> directive sets the file to
90 which the server records the process id of the daemon. If the
91 filename does not begin with a slash (/) then it is assumed to be
92 relative to the <directive module="core">ServerRoot</directive>.</p>
94 <p>It is often useful to be able to send the server a signal,
95 so that it closes and then reopens its <directive
96 module="core">ErrorLog</directive> and TransferLog, and
97 re-reads its configuration files. This is done by sending a
98 SIGHUP (kill -1) signal to the process id listed in the
101 <p>The PidFile is subject to the same warnings about log file
103 href="../misc/security_tips.html#serverroot">security</a>.</p>
109 <description>Sets the IP addresses and ports that the server
110 listens to</description>
111 <syntax>Listen [<em>IP-address</em>:]<em>portnumber</em></syntax>
112 <contextlist><context>server config</context></contextlist>
113 <modulelist><module>worker</module><module>perchild</module>
114 <module>prefork</module><module>mpm_winnt</module>
118 <p>The <directive>Listen</directive> directive instructs Apache to
119 listen to only specific IP addresses or ports; by default it
120 responds to requests on all IP interfaces. The Listen directive is
121 now a required directive. If it is not in the config file, the
122 server will fail to start. This is a change from previous versions
125 <p>The Listen directive tells the server to accept incoming
126 requests on the specified port or address-and-port combination.
127 If only a port number is specified, the server listens to the
128 given port on all interfaces. If an IP address is given as well
129 as a port, the server will listen on the given port and
132 <p>Multiple Listen directives may be used to specify a number
133 of addresses and ports to listen to. The server will respond to
134 requests from any of the listed addresses and ports.</p>
136 <p>For example, to make the server accept connections on both
137 port 80 and port 8000, use:</p>
142 To make the server accept connections on two specified
143 interfaces and port numbers, use
145 Listen 192.170.2.1:80<br />
146 Listen 192.170.2.5:8000
148 IPv6 addresses must be surrounded in square brackets, as in the
151 Listen [fe80::a00:20ff:fea7:ccea]:80
155 <seealso><a href="../dns-caveats.html">DNS Issues</a></seealso>
156 <seealso><a href="../bind.html">Setting
157 which addresses and ports Apache uses</a></seealso>
161 <name>ListenBackLog</name>
162 <description>Maximum length of the queue of pending connections</description>
163 <syntax>ListenBacklog <em>backlog</em></syntax>
164 <default>ListenBacklog 511</default>
165 <contextlist><context>server config</context></contextlist>
166 <modulelist><module>worker</module><module>perchild</module>
167 <module>prefork</module><module>mpm_winnt</module>
171 <p>The maximum length of the queue of pending connections.
172 Generally no tuning is needed or desired, however on some
173 systems it is desirable to increase this when under a TCP SYN
174 flood attack. See the backlog parameter to the
175 <code>listen(2)</code> system call.</p>
177 <p>This will often be limited to a smaller number by the
178 operating system. This varies from OS to OS. Also note that
179 many OSes do not use exactly what is specified as the backlog,
180 but use a number based on (but normally larger than) what is
186 <name>LockFile</name>
187 <description>Location of the accept serialization lock file</description>
188 <syntax>LockFile <em>filename</em></syntax>
189 <default>LockFile logs/accept.lock</default>
190 <contextlist><context>server config</context></contextlist>
191 <modulelist><module>worker</module><module>perchild</module>
192 <module>prefork</module></modulelist>
195 <p>The <directive>LockFile</directive> directive sets the path to
196 the lockfile used when Apache is compiled with either
197 USE_FCNTL_SERIALIZED_ACCEPT or USE_FLOCK_SERIALIZED_ACCEPT. This
198 directive should normally be left at its default value. The main
199 reason for changing it is if the <code>logs</code> directory is
200 NFS mounted, since <strong>the lockfile must be stored on a local
201 disk</strong>. The PID of the main server process is
202 automatically appended to the filename.</p>
204 <p><strong>SECURITY:</strong> It is best to avoid putting this
205 file in a world writable directory such as
206 <code>/var/tmp</code> because someone could create a denial of
207 service attack and prevent the server from starting by creating
208 a lockfile with the same name as the one the server will try to
214 <name>MaxClients</name>
215 <description>Maximum number of child processes that will be created
216 to serve requests</description>
217 <syntax>MaxClients <em>number</em></syntax>
219 8 (with threads) MaxClients 256</default>
220 <contextlist><context>server config</context></contextlist>
221 <modulelist><module>worker</module><module>prefork</module>
225 <p>The <directive>MaxClients</directive> directive sets the limit
226 on the number of child processes that will be created to serve
227 requests. When the server is built without threading, no more than
228 this number of clients can be served simultaneously. To configure
229 more than 256 clients with the prefork MPM, you must use the
230 <directive module="mpm_common">ServerLimit</directive> directive.
231 To configure more than 1024 clients with the worker MPM, you must
232 use the <directive module="mpm_common">ServerLimit</directive> and
233 <directive module="mpm_common">ThreadLimit</directive> directives.</p>
235 <p>Any connection attempts over the
236 <directive>MaxClients</directive> limit will normally be queued,
237 up to a number based on the <directive module="mpm_common"
238 >ListenBacklog</directive> directive. Once a child
239 process is freed at the end of a different request, the connection
240 will then be serviced.</p>
242 <p>When the server is compiled with threading, then the maximum
243 number of simultaneous requests that can be served is obtained
244 from the value of this directive multiplied by
245 <directive module="mpm_common">ThreadsPerChild</directive>.</p>
250 <name>MaxRequestsPerChild</name>
251 <description>Limit on the number of requests that an individual child server
252 will handle during its life</description>
253 <syntax>MaxRequestsPerChild <em>number</em></syntax>
254 <default>MaxRequestsPerChild 10000</default>
255 <contextlist><context>server config</context></contextlist>
256 <modulelist><module>worker</module><module>perchild</module>
257 <module>prefork</module><module>mpm_winnt</module>
261 <p>The <directive>MaxRequestsPerChild</directive> directive sets
262 the limit on the number of requests that an individual child
263 server process will handle. After
264 <directive>MaxRequestsPerChild</directive> requests, the child
265 process will die. If <directive>MaxRequestsPerChild</directive> is
266 0, then the process will never expire.</p>
268 <p>Setting <directive>MaxRequestsPerChild</directive> to a
269 non-zero limit has two beneficial effects:</p>
272 <li>it limits the amount of memory that process can consume
273 by (accidental) memory leakage;</li>
275 <li>by giving processes a finite lifetime, it helps reduce
276 the number of processes when the server load reduces.</li>
279 <p><strong>NOTE:</strong> For <em>KeepAlive</em> requests, only
280 the first request is counted towards this limit. In effect, it
281 changes the behavior to limit the number of
282 <em>connections</em> per child.</p>
287 <name>MaxSpareThreads</name>
288 <description>Maximum number of idle threads</description>
289 <syntax>MaxSpareThreads <em>number</em></syntax>
290 <default>MaxSpareThreads 10 (Perchild) or 500 (worker)</default>
291 <contextlist><context>server config</context></contextlist>
292 <modulelist><module>worker</module><module>perchild</module>
296 <p>Maximum number of idle threads. Different MPMs deal with this
297 directive differently. <module>perchild</module> monitors the
298 number of idle threads on a per-child basis. If there are too many
299 idle threads in that child, the server will begin to kill threads
300 within that child.</p>
302 <p><module>worker</module> deals with idle threads on a
303 server-wide basis. If there are too many idle threads in the
304 server then child processes are killed until the number of idle
305 threads is less than this number.</p>
308 <seealso><directive module="mpm_common">MinSpareThreads</directive></seealso>
309 <seealso><directive module="mpm_common">StartServers</directive></seealso>
313 <name>MaxThreadsPerChild</name>
314 <description>Maximum number of threads per child process</description>
315 <syntax>MaxThreadsPerChild <em>number</em></syntax>
316 <default>MaxThreadsPerChild 64</default>
317 <contextlist><context>server config</context></contextlist>
318 <modulelist><module>worker</module><module>perchild</module>
322 <p>Maximum number of threads per child. For MPMs with a
323 variable number of threads per child, this directive sets the
324 maximum number of threads that will be created in each child
325 process. To increase this value beyond its default, it is
326 necessary to change the value of the compile-time define
327 <code>HARD_THREAD_LIMIT</code> and recompile the server.</p>
332 <name>MinSpareThreads</name>
333 <description>Minimum number of idle threads available to handle request
335 <syntax>MinSpareServers <em>number</em></syntax>
336 <default>MinSpareThreads 5 (Perchild) or 250 (worker)</default>
337 <contextlist><context>server config</context></contextlist>
338 <modulelist><module>worker</module><module>perchild</module>
342 <p>Minimum number of idle threads to handle request spikes.
343 Different MPMs deal with this directive
344 differently. <module>perchild</module> monitors the number of idle
345 threads on a per-child basis. If there aren't enough idle threads
346 in that child, the server will begin to create new threads within
349 <p><module>worker</module> deals with idle threads on a
350 server-wide basis. If there aren't enough idle threads in the
351 server then child processes are created until the number of idle
352 threads is greater than number.</p>
354 <seealso><directive module="mpm_common">MaxSpareThreads</directive></seealso>
355 <seealso><directive module="mpm_common">StartServers</directive></seealso>
359 <name>NumServers</name>
360 <description>Total number of children alive at the same time</description>
361 <syntax>NumServers <em>number</em></syntax>
362 <default>NumServers 2</default>
363 <contextlist><context>server config</context></contextlist>
364 <modulelist><module>perchild</module></modulelist>
367 <p>Number of children alive at the same time. MPMs that use
368 this directive do not dynamically create new child processes so
369 this number should be large enough to handle the requests for
375 <name>ScoreBoardFile</name>
376 <description>Location of the file used to store coordination data for
377 the child processes</description>
378 <syntax>ScoreBoardFile <em>file-path</em></syntax>
379 <default>ScoreBoardFile logs/apache_status</default>
380 <contextlist><context>server config</context></contextlist>
381 <modulelist><module>worker</module><module>perchild</module>
382 <module>prefork</module></modulelist>
385 <p>The <directive>ScoreBoardFile</directive> directive is required
386 on some architectures to place a file that the server will use to
387 communicate between its children and the parent. The easiest way
388 to find out if your architecture requires a scoreboard file is to
389 run Apache and see if it creates the file named by the
390 directive. If your architecture requires it then you must ensure
391 that this file is not used at the same time by more than one
392 invocation of Apache.</p>
394 <p>If you have to use a <directive>ScoreBoardFile</directive> then
395 you may see improved speed by placing it on a RAM disk. But be
396 careful that you heed the same warnings about log file placement
397 and <a href="../misc/security_tips.html">security</a>.</p>
400 href="../stopping.html">Stopping and Restarting Apache</a></seealso>
404 <name>SendBufferSize</name>
405 <description>TCP buffer size</description>
406 <syntax>SendBufferSize <em>bytes</em></syntax>
407 <contextlist><context>server config</context></contextlist>
408 <modulelist><module>worker</module><module>perchild</module>
409 <module>prefork</module><module>mpm_winnt</module>
413 <p>The server will set the TCP buffer size to the number of bytes
414 specified. Very useful to increase past standard OS defaults on
415 high speed high latency (<em>i.e.</em>, 100ms or so, such as
416 transcontinental fast pipes).</p>
421 <name>ServerLimit</name>
422 <description>Upper limit on configurable number of processes</description>
423 <syntax>ServerLimit <em>number</em></syntax>
424 <default>ServerLimit 256 (prefork), ServerLimit 16 (worker)</default>
425 <contextlist><context>server config</context></contextlist>
426 <modulelist><module>worker</module><module>prefork</module>
430 <p>For the <module>prefork</module> MPM, this directive sets the
431 maximum configured value for <directive
432 module="mpm_common">MaxClients</directive> for the lifetime of the
433 Apache process. For the worker MPM, this directive in combination
434 with <directive module="mpm_common">ThreadLimit</directive> sets
435 the maximum configured value for <directive
436 module="mpm_common">MaxClients</directive> for the lifetime of the
437 Apache process. Any attempts to change this directive during a
438 restart will be ignored, but <directive
439 module="mpm_common">MaxClients</directive> can be modified during
442 <p>Special care must be taken when using this directive. If
443 <directive>ServerLimit</directive> is set to a value much higher
444 than necessary, extra, unused shared memory will be allocated. If
445 both <directive>ServerLimit</directive> and <directive
446 module="mpm_common">MaxClients</directive> are set to values
447 higher than the system can handle, Apache may not start or the
448 system may become unstable.</p>
450 <p>With the <module>prefork</module> MPM, use this directive only
451 if you need to set <directive
452 module="mpm_common">MaxClients</directive> higher higher than 256.
453 Do not set the value of this directive any higher than what you
454 might want to set <directive
455 module="mpm_common">MaxClients</directive> to.</p>
457 <p>With the <module>worker</module> MPM, use this directive only
458 if your <directive module="mpm_common">MaxClients</directive> and
459 <directive module="mpm_common">ThreadsPerChild</directive>
460 settings require more than 16 server processes. Do not set the
461 value of this directive any higher than the number of server
462 processes required by what you may want for <directive
463 module="mpm_common">MaxClients </directive> and <directive
464 module="mpm_common">ThreadsPerChild</directive>.</p>
469 <name>StartServers</name>
470 <description>Number of child server processes created at startup</description>
471 <syntax>StartServers <em>number</em></syntax>
472 <default>StartServers 5</default>
473 <contextlist><context>server config</context></contextlist>
474 <modulelist><module>worker</module></modulelist>
477 <p>The <directive>StartServers</directive> directive sets the
478 number of child server processes created on startup. As the number
479 of processes is dynamically controlled depending on the load,
480 there is usually little reason to adjust this parameter.</p>
482 <seealso><directive module="mpm_common">MinSpareThreads</directive></seealso>
483 <seealso><directive module="mpm_common">MaxSpareThreads</directive></seealso>
487 <name>StartThreads</name>
488 <description>Nubmer of threads each child creates on startup</description>
489 <syntax>StartThreads <em>number</em></syntax>
490 <default>StartThreads 5</default>
491 <contextlist><context>server config</context></contextlist>
492 <modulelist><module>perchild</module></modulelist>
495 <p>Number of threads each child creates on startup. As the
496 number of threads is dynamically controlled depending on the
497 load, there is usually little reason to adjust this
503 <name>ThreadLimit</name>
504 <description>Sets the upper limit on the configurable number of threads
505 per child process</description>
506 <syntax>ThreadLimit <em>number</em></syntax>
507 <default>ThreadLimit 64</default>
508 <contextlist><context>server config</context></contextlist>
509 <modulelist><module>worker</module></modulelist>
512 <p>This directive sets the maximum configured value for <directive
513 module="mpm_common">ThreadsPerChild</directive> for the lifetime
514 of the Apache process. Any attempts to change this directive
515 during a restart will be ignored, but <directive
516 module="mpm_common">ThreadsPerChild</directive> can be modified
517 during a restart up to the value of this directive.</p>
519 <p>Special care must be taken when using this directive. If
520 <directive>ThreadLimit</directive> is set to a value much higher
521 than <directive module="mpm_common">ThreadsPerChild</directive>,
522 extra unused shared memory will be allocated. If both
523 <directive>ThreadLimit</directive> and <directive
524 module="mpm_common">ThreadsPerChild</directive> are set to values
525 higher than the system can handle, Apache may not start or the
526 system may become unstable.</p>
528 <p>Use this directive only if you need to set <directive
529 module="mpm_common">ThreadsPerChild</directive> higher than 64. Do
530 not set the value of this directive any higher than what you might
531 want to set <directive
532 module="mpm_common">ThreadsPerChild</directive> to.</p>
537 <name>ThreadsPerChild</name>
538 <description>Number of threads created by each child process</description>
539 <syntax>ThreadsPerChild <em>number</em></syntax>
540 <default>ThreadsPerChild 50</default>
541 <contextlist><context>server config</context></contextlist>
542 <modulelist><module>worker</module><module>mpm_winnt</module>
546 <p>This directive sets the number of threads created by each
547 child process. The child creates these threads at startup and
548 never creates more. if using an MPM like mpmt_winnt, where
549 there is only one child process, this number should be high
550 enough to handle the entire load of the server. If using an MPM
551 like worker, where there are multiple child processes, the
552 total number of threads should be high enough to handle the
553 common load on the server.</p>
559 <description>The userid under which the server will answer
560 requests</description>
561 <syntax>User <em>unix-userid</em></syntax>
562 <default>User #-1</default>
563 <contextlist><context>server config</context><context>virtual host</context>
565 <modulelist><module>worker</module><module>perchild</module>
566 <module>prefork</module></modulelist>
569 <p>The <directive>User</directive> directive sets the userid as
570 which the server will answer requests. In order to use this
571 directive, the standalone server must be run initially as
572 root. <em>Unix-userid</em> is one of:</p>
577 <dd>Refers to the given user by name.</dd>
579 <dt># followed by a user number.</dt>
581 <dd>Refers to a user by their number.</dd>
584 <p>The user should have no privileges which result in it being
585 able to access files which are not intended to be visible to the
586 outside world, and similarly, the user should not be able to
587 execute code which is not meant for httpd requests. It is
588 recommended that you set up a new user and group specifically for
589 running the server. Some admins use user <code>nobody</code>, but
590 this is not always possible or desirable. For example
591 <module>mod_proxy</module>'s cache, when enabled, must be
592 accessible to this user (see <directive
593 module="mod_proxy">CacheRoot</directive>).</p>
595 <p>Notes: If you start the server as a non-root user, it will
596 fail to change to the lesser privileged user, and will instead
597 continue to run as that original user. If you do start the
598 server as root, then it is normal for the parent process to
599 remain running as root.</p>
601 <p>Special note: Use of this directive in <directive module="core"
602 type="section">VirtualHost</directive> is no longer supported. To
603 configure your server for <a href="mod_suexec.html">suexec</a> use
604 <directive module="mod_suexec">SuexecUserGroup</directive>.</p>
606 <note><title>Security</title> <p>Don't set <directive>User</directive>
607 (or <directive module="mpm_common">Group</directive>) to
608 <code>root</code> unless you know exactly what you are doing, and what
609 the dangers are.</p></note>