1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
|
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
This file is generated from xml source: DO NOT EDIT
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
--><title>mpm_common - Apache HTTP Server</title><link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" /><link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" /><link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link href="../images/favicon.ico" rel="shortcut icon" /></head><body><div id="page-header"><p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p><p class="apache">Apache HTTP Server Version 2.0</p><img alt="" src="../images/feather.gif" /></div><div class="up"><a href="./"><img title="<-" alt="<-" src="../images/left.gif" /></a></div><div id="path"><a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs-project/">Documentation</a> > <a href="../">Version 2.0</a> > <a href="./">Modules</a></div><div id="page-content"><div id="preamble"><h1>Apache Module mpm_common</h1><table class="module"><tr><th><a href="module-dict.html#Description">Description:
</a></th><td>A collection of directives that are implemented by
more than one multi-processing module (MPM)</td></tr><tr><th><a href="module-dict.html#Status">Status:
</a></th><td>MPM</td></tr></table></div><div id="quickview"><h3 class="directives">Directives</h3><ul id="toc"><li><img alt="" src="../images/down.gif" /> <a href="#coredumpdirectory">CoreDumpDirectory</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#group">Group</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#listen">Listen</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#listenbacklog">ListenBackLog</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#lockfile">LockFile</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#maxclients">MaxClients</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#maxmemfree">MaxMemFree</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#maxrequestsperchild">MaxRequestsPerChild</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#maxsparethreads">MaxSpareThreads</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#maxthreadsperchild">MaxThreadsPerChild</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#minsparethreads">MinSpareThreads</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#numservers">NumServers</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#pidfile">PidFile</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#scoreboardfile">ScoreBoardFile</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#sendbuffersize">SendBufferSize</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#serverlimit">ServerLimit</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#startservers">StartServers</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#startthreads">StartThreads</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#threadlimit">ThreadLimit</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#threadsperchild">ThreadsPerChild</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#user">User</a></li>
</ul></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="CoreDumpDirectory" id="CoreDumpDirectory">CoreDumpDirectory</a> <a name="coredumpdirectory" id="coredumpdirectory">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:
</a></th><td>Directory where Apache attempts to
switch before dumping core</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
</a></th><td><code>CoreDumpDirectory <em>directory</em></code></td></tr><tr><th><a href="directive-dict.html#Default">Default:
</a></th><td><code>See usage for the default setting</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:
</a></th><td>server config</td></tr><tr><th><a href="directive-dict.html#Status">Status:
</a></th><td>MPM</td></tr><tr><th><a href="directive-dict.html#Module">Module:
</a></th><td><code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/perchild.html">perchild</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code></td></tr></table>
<p>This controls the directory to which Apache attempts to
switch before dumping core. The default is in the
<code class="directive"><a href="../mod/core.html#serverroot">ServerRoot</a></code> directory, however
since this should not be writable by the user the server runs
as, core dumps won't normally get written. If you want a core
dump for debugging, you can use this directive to place it in a
different location.</p>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="Group" id="Group">Group</a> <a name="group" id="group">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:
</a></th><td>Group under which the server will answer
requests</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
</a></th><td><code>Group <em>unix-group</em></code></td></tr><tr><th><a href="directive-dict.html#Default">Default:
</a></th><td><code>Group #-1</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:
</a></th><td>server config, virtual host</td></tr><tr><th><a href="directive-dict.html#Status">Status:
</a></th><td>MPM</td></tr><tr><th><a href="directive-dict.html#Module">Module:
</a></th><td><code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/perchild.html">perchild</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code></td></tr></table>
<p>The <code class="directive">Group</code> directive sets the group under
which the server will answer requests. In order to use this
directive, the stand-alone server must be run initially as root.
<em>Unix-group</em> is one of:</p>
<dl>
<dt>A group name</dt>
<dd>Refers to the given group by name.</dd>
<dt># followed by a group number.</dt>
<dd>Refers to a group by its number.</dd>
</dl>
<p>It is recommended that you set up a new group specifically for
running the server. Some admins use user <code>nobody</code>,
but this is not always possible or desirable.</p>
<p>Note: if you start the server as a non-root user, it will
fail to change to the specified group, and will instead
continue to run as the group of the original user.</p>
<p>Special note: Use of this directive in <VirtualHost> is
no longer supported. To implement the <a href="../suexec.html">suEXEC wrapper</a> with Apache 2.0, use the
<code class="directive"><a href="../mod/mod_suexec.html#suexecusergroup">SuexecUserGroup</a></code>
directive. SECURITY: See <code class="directive"><a href="#user">User</a></code> for a discussion of the
security considerations.</p>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="Listen" id="Listen">Listen</a> <a name="listen" id="listen">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:
</a></th><td>IP addresses and ports that the server
listens to</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
</a></th><td><code>Listen [<em>IP-address</em>:]<em>portnumber</em></code></td></tr><tr><th><a href="directive-dict.html#Context">Context:
</a></th><td>server config</td></tr><tr><th><a href="directive-dict.html#Status">Status:
</a></th><td>MPM</td></tr><tr><th><a href="directive-dict.html#Module">Module:
</a></th><td><code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/perchild.html">perchild</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code></td></tr></table>
<p>The <code class="directive">Listen</code> directive instructs Apache to
listen to only specific IP addresses or ports; by default it
responds to requests on all IP interfaces. The Listen directive is
now a required directive. If it is not in the config file, the
server will fail to start. This is a change from previous versions
of Apache.</p>
<p>The Listen directive tells the server to accept incoming
requests on the specified port or address-and-port combination.
If only a port number is specified, the server listens to the
given port on all interfaces. If an IP address is given as well
as a port, the server will listen on the given port and
interface.</p>
<p>Multiple Listen directives may be used to specify a number
of addresses and ports to listen to. The server will respond to
requests from any of the listed addresses and ports.</p>
<p>For example, to make the server accept connections on both
port 80 and port 8000, use:</p>
<div class="example"><p><code>
Listen 80<br />
Listen 8000
</code></p></div>
<p>To make the server accept connections on two specified
interfaces and port numbers, use </p>
<div class="example"><p><code>
Listen 192.170.2.1:80<br />
Listen 192.170.2.5:8000
</code></p></div>
<p>IPv6 addresses must be surrounded in square brackets, as in the
following example:</p>
<div class="example"><p><code>
Listen [fe80::a00:20ff:fea7:ccea]:80
</code></p></div>
<h3>See also</h3><ul><li><a href="../dns-caveats.html">DNS Issues</a></li><li><a href="../bind.html">Setting
which addresses and ports Apache uses</a></li></ul></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="ListenBackLog" id="ListenBackLog">ListenBackLog</a> <a name="listenbacklog" id="listenbacklog">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:
</a></th><td>Maximum length of the queue of pending connections</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
</a></th><td><code>ListenBacklog <em>backlog</em></code></td></tr><tr><th><a href="directive-dict.html#Default">Default:
</a></th><td><code>ListenBacklog 511</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:
</a></th><td>server config</td></tr><tr><th><a href="directive-dict.html#Status">Status:
</a></th><td>MPM</td></tr><tr><th><a href="directive-dict.html#Module">Module:
</a></th><td><code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/perchild.html">perchild</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code></td></tr></table>
<p>The maximum length of the queue of pending connections.
Generally no tuning is needed or desired, however on some
systems it is desirable to increase this when under a TCP SYN
flood attack. See the backlog parameter to the
<code>listen(2)</code> system call.</p>
<p>This will often be limited to a smaller number by the
operating system. This varies from OS to OS. Also note that
many OSes do not use exactly what is specified as the backlog,
but use a number based on (but normally larger than) what is
set.</p>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="LockFile" id="LockFile">LockFile</a> <a name="lockfile" id="lockfile">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:
</a></th><td>Location of the accept serialization lock file</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
</a></th><td><code>LockFile <em>filename</em></code></td></tr><tr><th><a href="directive-dict.html#Default">Default:
</a></th><td><code>LockFile logs/accept.lock</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:
</a></th><td>server config</td></tr><tr><th><a href="directive-dict.html#Status">Status:
</a></th><td>MPM</td></tr><tr><th><a href="directive-dict.html#Module">Module:
</a></th><td><code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/perchild.html">perchild</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code></td></tr></table>
<p>The <code class="directive">LockFile</code> directive sets the path to
the lockfile used when Apache is compiled with either
USE_FCNTL_SERIALIZED_ACCEPT or USE_FLOCK_SERIALIZED_ACCEPT. This
directive should normally be left at its default value. The main
reason for changing it is if the <code>logs</code> directory is
NFS mounted, since <strong>the lockfile must be stored on a local
disk</strong>. The PID of the main server process is
automatically appended to the filename.</p>
<p><strong>SECURITY:</strong> It is best to avoid putting this
file in a world writable directory such as
<code>/var/tmp</code> because someone could create a denial of
service attack and prevent the server from starting by creating
a lockfile with the same name as the one the server will try to
create.</p>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="MaxClients" id="MaxClients">MaxClients</a> <a name="maxclients" id="maxclients">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:
</a></th><td>Maximum number of child processes that will be created
to serve requests</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
</a></th><td><code>MaxClients <em>number</em></code></td></tr><tr><th><a href="directive-dict.html#Context">Context:
</a></th><td>server config</td></tr><tr><th><a href="directive-dict.html#Status">Status:
</a></th><td>MPM</td></tr><tr><th><a href="directive-dict.html#Module">Module:
</a></th><td><code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code></td></tr></table>
<p>The <code class="directive">MaxClients</code> directive sets the limit
on the number of simultaneous requests that will be served. Any
connection attempts over the <code class="directive">MaxClients</code>
limit will normally be queued, up to a number based on the
<code class="directive"><a href="#listenbacklog">ListenBacklog</a></code>
directive. Once a child process is freed at the end of a different
request, the connection will then be serviced.</p>
<p>For non-threaded servers (i.e., <code class="module"><a href="../mod/prefork.html">prefork</a></code>),
<code class="directive">MaxClients</code> translates into the maximum
number of child processes that will be launched to serve requests.
The default value is 256; to increase it, you must also raise
<code class="directive"><a href="#serverlimit">ServerLimit</a></code>.</p>
<p>For threaded servers (i.e., <code class="module"><a href="../mod/worker.html">worker</a></code>),
<code class="directive">MaxClients</code> restricts the total
number of threads that will be available to serve clients.
The default value is 16 multiplied by the value of
<code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code>.
To increase <code class="directive">MaxClients</code> to a value
that requires more than 16 processes, you must also
raise <code class="directive"><a href="#serverlimit">ServerLimit</a></code>.</p>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="MaxMemFree" id="MaxMemFree">MaxMemFree</a> <a name="maxmemfree" id="maxmemfree">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:
</a></th><td>Maximum amount of memory that the main allocator is allowed
to hold without calling free()</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
</a></th><td><code>MaxMemFree <em>number</em></code></td></tr><tr><th><a href="directive-dict.html#Context">Context:
</a></th><td>server config</td></tr><tr><th><a href="directive-dict.html#Status">Status:
</a></th><td>MPM</td></tr><tr><th><a href="directive-dict.html#Module">Module:
</a></th><td><code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code></td></tr></table>
<p>The <code class="directive">MaxMemFree</code> directive sets the
maximum number of free Kbytes that the main allocator is allowed
to hold without calling free(). When not set, or when set to
zero, the threshold will be set to unlimited.</p>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="MaxRequestsPerChild" id="MaxRequestsPerChild">MaxRequestsPerChild</a> <a name="maxrequestsperchild" id="maxrequestsperchild">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:
</a></th><td>Limit on the number of requests that an individual child server
will handle during its life</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
</a></th><td><code>MaxRequestsPerChild <em>number</em></code></td></tr><tr><th><a href="directive-dict.html#Default">Default:
</a></th><td><code>MaxRequestsPerChild 10000</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:
</a></th><td>server config</td></tr><tr><th><a href="directive-dict.html#Status">Status:
</a></th><td>MPM</td></tr><tr><th><a href="directive-dict.html#Module">Module:
</a></th><td><code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/perchild.html">perchild</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code></td></tr></table>
<p>The <code class="directive">MaxRequestsPerChild</code> directive sets
the limit on the number of requests that an individual child
server process will handle. After
<code class="directive">MaxRequestsPerChild</code> requests, the child
process will die. If <code class="directive">MaxRequestsPerChild</code> is
0, then the process will never expire.</p>
<p>Setting <code class="directive">MaxRequestsPerChild</code> to a
non-zero limit has two beneficial effects:</p>
<ul>
<li>it limits the amount of memory that process can consume
by (accidental) memory leakage;</li>
<li>by giving processes a finite lifetime, it helps reduce
the number of processes when the server load reduces.</li>
</ul>
<p><strong>NOTE:</strong> For <em>KeepAlive</em> requests, only
the first request is counted towards this limit. In effect, it
changes the behavior to limit the number of
<em>connections</em> per child.</p>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="MaxSpareThreads" id="MaxSpareThreads">MaxSpareThreads</a> <a name="maxsparethreads" id="maxsparethreads">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:
</a></th><td>Maximum number of idle threads</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
</a></th><td><code>MaxSpareThreads <em>number</em></code></td></tr><tr><th><a href="directive-dict.html#Context">Context:
</a></th><td>server config</td></tr><tr><th><a href="directive-dict.html#Status">Status:
</a></th><td>MPM</td></tr><tr><th><a href="directive-dict.html#Module">Module:
</a></th><td><code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>, <code class="module"><a href="../mod/perchild.html">perchild</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr></table>
<p>Maximum number of idle threads. Different MPMs deal with this
directive differently.</p>
<p>For <code class="module"><a href="../mod/perchild.html">perchild</a></code> the default is
<code>MaxSpareThreads 10</code>. This MPM monitors the number of
idle threads on a per-child basis. If there are too many idle
threads in that child, the server will begin to kill threads
within that child.</p>
<p>For <code class="module"><a href="../mod/worker.html">worker</a></code> the default is
<code>MaxSpareThreads 500</code>. This MPM deals with idle threads
on a server-wide basis. If there are too many idle threads in the
server then child processes are killed until the number of idle
threads is less than this number.</p>
<p>For <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code> the default is
<code>MaxSpareThreads 100</code>. Since this MPM runs a
single-process, the spare thread count is also server-wide.</p>
<h3>See also</h3><ul><li><code class="directive"><a href="#minsparethreads">MinSpareThreads</a></code></li><li><code class="directive"><a href="#startservers">StartServers</a></code></li></ul></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="MaxThreadsPerChild" id="MaxThreadsPerChild">MaxThreadsPerChild</a> <a name="maxthreadsperchild" id="maxthreadsperchild">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:
</a></th><td>Maximum number of threads per child process</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
</a></th><td><code>MaxThreadsPerChild <em>number</em></code></td></tr><tr><th><a href="directive-dict.html#Default">Default:
</a></th><td><code>MaxThreadsPerChild 64</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:
</a></th><td>server config</td></tr><tr><th><a href="directive-dict.html#Status">Status:
</a></th><td>MPM</td></tr><tr><th><a href="directive-dict.html#Module">Module:
</a></th><td><code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/perchild.html">perchild</a></code></td></tr></table>
<p>Maximum number of threads per child. For MPMs with a
variable number of threads per child, this directive sets the
maximum number of threads that will be created in each child
process. To increase this value beyond its default, it is
necessary to change the value of the compile-time define
<code>HARD_THREAD_LIMIT</code> and recompile the server.</p>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="MinSpareThreads" id="MinSpareThreads">MinSpareThreads</a> <a name="minsparethreads" id="minsparethreads">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:
</a></th><td>Minimum number of idle threads available to handle request
spikes</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
</a></th><td><code>MinSpareServers <em>number</em></code></td></tr><tr><th><a href="directive-dict.html#Context">Context:
</a></th><td>server config</td></tr><tr><th><a href="directive-dict.html#Status">Status:
</a></th><td>MPM</td></tr><tr><th><a href="directive-dict.html#Module">Module:
</a></th><td><code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>, <code class="module"><a href="../mod/perchild.html">perchild</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr></table>
<p>Minimum number of idle threads to handle request spikes.
Different MPMs deal with this directive
differently.</p>
<p><code class="module"><a href="../mod/perchild.html">perchild</a></code> uses a default of
<code>MinSpareThreads 5</code> and monitors the number of idle
threads on a per-child basis. If there aren't enough idle threads
in that child, the server will begin to create new threads within
that child.</p>
<p><code class="module"><a href="../mod/worker.html">worker</a></code> uses a default of <code>MinSpareThreads
250</code> and deals with idle threads on a server-wide basis. If
there aren't enough idle threads in the server then child
processes are created until the number of idle threads is greater
than number.</p>
<p><code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code> uses a default of
<code>MinSpareThreads 10</code> and, since it is a single-process
MPM, tracks this on a server-wide bases.</p>
<h3>See also</h3><ul><li><code class="directive"><a href="#maxsparethreads">MaxSpareThreads</a></code></li><li><code class="directive"><a href="#startservers">StartServers</a></code></li></ul></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="NumServers" id="NumServers">NumServers</a> <a name="numservers" id="numservers">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:
</a></th><td>Total number of children alive at the same time</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
</a></th><td><code>NumServers <em>number</em></code></td></tr><tr><th><a href="directive-dict.html#Default">Default:
</a></th><td><code>NumServers 2</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:
</a></th><td>server config</td></tr><tr><th><a href="directive-dict.html#Status">Status:
</a></th><td>MPM</td></tr><tr><th><a href="directive-dict.html#Module">Module:
</a></th><td><code class="module"><a href="../mod/perchild.html">perchild</a></code></td></tr></table>
<p>Number of children alive at the same time. MPMs that use
this directive do not dynamically create new child processes so
this number should be large enough to handle the requests for
the entire site.</p>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="PidFile" id="PidFile">PidFile</a> <a name="pidfile" id="pidfile">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:
</a></th><td>File where the server records the process ID
of the daemon</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
</a></th><td><code>PidFile <em>filename</em></code></td></tr><tr><th><a href="directive-dict.html#Default">Default:
</a></th><td><code>PidFile logs/httpd.pid</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:
</a></th><td>server config</td></tr><tr><th><a href="directive-dict.html#Status">Status:
</a></th><td>MPM</td></tr><tr><th><a href="directive-dict.html#Module">Module:
</a></th><td><code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/perchild.html">perchild</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code></td></tr></table>
<p>The <code class="directive">PidFile</code> directive sets the file to
which the server records the process id of the daemon. If the
filename does not begin with a slash (/) then it is assumed to be
relative to the <code class="directive"><a href="../mod/core.html#serverroot">ServerRoot</a></code>.</p>
<div class="example"><h3>Example</h3><p><code>
PidFile /var/run/apache.pid
</code></p></div>
<p>It is often useful to be able to send the server a signal,
so that it closes and then reopens its <code class="directive"><a href="../mod/core.html#errorlog">ErrorLog</a></code> and TransferLog, and
re-reads its configuration files. This is done by sending a
SIGHUP (kill -1) signal to the process id listed in the
PidFile.</p>
<p>The PidFile is subject to the same warnings about log file
placement and <a href="../misc/security_tips.html#serverroot">security</a>.</p>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="ScoreBoardFile" id="ScoreBoardFile">ScoreBoardFile</a> <a name="scoreboardfile" id="scoreboardfile">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:
</a></th><td>Location of the file used to store coordination data for
the child processes</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
</a></th><td><code>ScoreBoardFile <em>file-path</em></code></td></tr><tr><th><a href="directive-dict.html#Default">Default:
</a></th><td><code>ScoreBoardFile logs/apache_status</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:
</a></th><td>server config</td></tr><tr><th><a href="directive-dict.html#Status">Status:
</a></th><td>MPM</td></tr><tr><th><a href="directive-dict.html#Module">Module:
</a></th><td><code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/perchild.html">perchild</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code></td></tr></table>
<p>Apache uses a scoreboard to communicate between its parent
and child processes. Some architectures require a file to facilitate
this communication. If the file is left unspecified, Apache first
attempts to create the scoreboard entirely in memory (using anonymous
shared memory) and, failing that, will attempt to create the file on
disk (using file-based shared memory). Specifying this directive causes
Apache to always create the file on the disk.</p>
<div class="example"><h3>Example</h3><p><code>
ScoreBoardFile /var/run/apache_status
</code></p></div>
<p>File-based shared memory is useful for third-party applications
that require direct access to the scoreboard.</p>
<p>If you use a <code class="directive">ScoreBoardFile</code> then
you may see improved speed by placing it on a RAM disk. But be
careful that you heed the same warnings about log file placement
and <a href="../misc/security_tips.html">security</a>.</p>
<h3>See also</h3><ul><li><a href="../stopping.html">Stopping and Restarting Apache</a></li></ul></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="SendBufferSize" id="SendBufferSize">SendBufferSize</a> <a name="sendbuffersize" id="sendbuffersize">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:
</a></th><td>TCP buffer size</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
</a></th><td><code>SendBufferSize <em>bytes</em></code></td></tr><tr><th><a href="directive-dict.html#Context">Context:
</a></th><td>server config</td></tr><tr><th><a href="directive-dict.html#Status">Status:
</a></th><td>MPM</td></tr><tr><th><a href="directive-dict.html#Module">Module:
</a></th><td><code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/perchild.html">perchild</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code></td></tr></table>
<p>The server will set the TCP buffer size to the number of bytes
specified. Very useful to increase past standard OS defaults on
high speed high latency (<em>i.e.</em>, 100ms or so, such as
transcontinental fast pipes).</p>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="ServerLimit" id="ServerLimit">ServerLimit</a> <a name="serverlimit" id="serverlimit">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:
</a></th><td>Upper limit on configurable number of processes</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
</a></th><td><code>ServerLimit <em>number</em></code></td></tr><tr><th><a href="directive-dict.html#Default">Default:
</a></th><td><code>ServerLimit 256 (prefork), ServerLimit 16 (worker)</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:
</a></th><td>server config</td></tr><tr><th><a href="directive-dict.html#Status">Status:
</a></th><td>MPM</td></tr><tr><th><a href="directive-dict.html#Module">Module:
</a></th><td><code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code></td></tr></table>
<p>For the <code class="module"><a href="../mod/prefork.html">prefork</a></code> MPM, this directive sets the
maximum configured value for <code class="directive"><a href="#maxclients">MaxClients</a></code> for the lifetime of the
Apache process. For the worker MPM, this directive in combination
with <code class="directive"><a href="#threadlimit">ThreadLimit</a></code> sets
the maximum configured value for <code class="directive"><a href="#maxclients">MaxClients</a></code> for the lifetime of the
Apache process. Any attempts to change this directive during a
restart will be ignored, but <code class="directive"><a href="#maxclients">MaxClients</a></code> can be modified during
a restart.</p>
<p>Special care must be taken when using this directive. If
<code class="directive">ServerLimit</code> is set to a value much higher
than necessary, extra, unused shared memory will be allocated. If
both <code class="directive">ServerLimit</code> and <code class="directive"><a href="#maxclients">MaxClients</a></code> are set to values
higher than the system can handle, Apache may not start or the
system may become unstable.</p>
<p>With the <code class="module"><a href="../mod/prefork.html">prefork</a></code> MPM, use this directive only
if you need to set <code class="directive"><a href="#maxclients">MaxClients</a></code> higher than 256.
Do not set the value of this directive any higher than what you
might want to set <code class="directive"><a href="#maxclients">MaxClients</a></code> to.</p>
<p>With the <code class="module"><a href="../mod/worker.html">worker</a></code> MPM, use this directive only
if your <code class="directive"><a href="#maxclients">MaxClients</a></code> and
<code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code>
settings require more than 16 server processes. Do not set the
value of this directive any higher than the number of server
processes required by what you may want for <code class="directive"><a href="#maxclients ">MaxClients </a></code> and <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code>.</p>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="StartServers" id="StartServers">StartServers</a> <a name="startservers" id="startservers">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:
</a></th><td>Number of child server processes created at startup</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
</a></th><td><code>StartServers <em>number</em></code></td></tr><tr><th><a href="directive-dict.html#Default">Default:
</a></th><td><code>StartServers 5</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:
</a></th><td>server config</td></tr><tr><th><a href="directive-dict.html#Status">Status:
</a></th><td>MPM</td></tr><tr><th><a href="directive-dict.html#Module">Module:
</a></th><td><code class="module"><a href="../mod/worker.html">worker</a></code></td></tr></table>
<p>The <code class="directive">StartServers</code> directive sets the
number of child server processes created on startup. As the number
of processes is dynamically controlled depending on the load,
there is usually little reason to adjust this parameter.</p>
<h3>See also</h3><ul><li><code class="directive"><a href="#minsparethreads">MinSpareThreads</a></code></li><li><code class="directive"><a href="#maxsparethreads">MaxSpareThreads</a></code></li></ul></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="StartThreads" id="StartThreads">StartThreads</a> <a name="startthreads" id="startthreads">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:
</a></th><td>Nubmer of threads created on startup</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
</a></th><td><code>StartThreads <em>number</em></code></td></tr><tr><th><a href="directive-dict.html#Context">Context:
</a></th><td>server config</td></tr><tr><th><a href="directive-dict.html#Status">Status:
</a></th><td>MPM</td></tr><tr><th><a href="directive-dict.html#Module">Module:
</a></th><td><code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>, <code class="module"><a href="../mod/perchild.html">perchild</a></code></td></tr></table>
<p>Number of threads created on startup. As the
number of threads is dynamically controlled depending on the
load, there is usually little reason to adjust this
parameter.</p>
<p>For <code class="module"><a href="../mod/perchild.html">perchild</a></code> the default is <code>StartThreads
5</code> and this directive tracks the number of threads per
process at startup.</p>
<p>For <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code> the default is
<code>StartThreads 50</code> and, since there is only a single
process, this is the total number of threads created at startup to
serve requests.</p>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="ThreadLimit" id="ThreadLimit">ThreadLimit</a> <a name="threadlimit" id="threadlimit">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:
</a></th><td>Sets the upper limit on the configurable number of threads
per child process</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
</a></th><td><code>ThreadLimit <em>number</em></code></td></tr><tr><th><a href="directive-dict.html#Context">Context:
</a></th><td>server config</td></tr><tr><th><a href="directive-dict.html#Status">Status:
</a></th><td>MPM</td></tr><tr><th><a href="directive-dict.html#Module">Module:
</a></th><td><code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr></table>
<p>This directive sets the maximum configured value for <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code> for the lifetime
of the Apache process. Any attempts to change this directive
during a restart will be ignored, but <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code> can be modified
during a restart up to the value of this directive.</p>
<p>Special care must be taken when using this directive. If
<code class="directive">ThreadLimit</code> is set to a value much higher
than <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code>,
extra unused shared memory will be allocated. If both
<code class="directive">ThreadLimit</code> and <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code> are set to values
higher than the system can handle, Apache may not start or the
system may become unstable. Do not set the value of this directive
any higher than your greatest predicted setting of <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code> for the
current run of Apache.</p>
<p>The default value for <code class="directive">ThreadLimit</code> is
64 when used with <code class="module"><a href="../mod/worker.html">worker</a></code> and 1920 when used
with <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>.</p>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="ThreadsPerChild" id="ThreadsPerChild">ThreadsPerChild</a> <a name="threadsperchild" id="threadsperchild">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:
</a></th><td>Number of threads created by each child process</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
</a></th><td><code>ThreadsPerChild <em>number</em></code></td></tr><tr><th><a href="directive-dict.html#Context">Context:
</a></th><td>server config</td></tr><tr><th><a href="directive-dict.html#Status">Status:
</a></th><td>MPM</td></tr><tr><th><a href="directive-dict.html#Module">Module:
</a></th><td><code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code></td></tr></table>
<p>This directive sets the number of threads created by each
child process. The child creates these threads at startup and
never creates more. If using an MPM like mpmt_winnt, where
there is only one child process, this number should be high
enough to handle the entire load of the server. If using an MPM
like worker, where there are multiple child processes, the
total number of threads should be high enough to handle the
common load on the server.</p>
<p>The default value for this directive is 25 when used with
<code class="module"><a href="../mod/worker.html">worker</a></code> and 64 when used with
<code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>.</p>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="User" id="User">User</a> <a name="user" id="user">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:
</a></th><td>The userid under which the server will answer
requests</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
</a></th><td><code>User <em>unix-userid</em></code></td></tr><tr><th><a href="directive-dict.html#Default">Default:
</a></th><td><code>User #-1</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:
</a></th><td>server config, virtual host</td></tr><tr><th><a href="directive-dict.html#Status">Status:
</a></th><td>MPM</td></tr><tr><th><a href="directive-dict.html#Module">Module:
</a></th><td><code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/perchild.html">perchild</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code></td></tr></table>
<p>The <code class="directive">User</code> directive sets the userid as
which the server will answer requests. In order to use this
directive, the standalone server must be run initially as
root. <em>Unix-userid</em> is one of:</p>
<dl>
<dt>A username</dt>
<dd>Refers to the given user by name.</dd>
<dt># followed by a user number.</dt>
<dd>Refers to a user by their number.</dd>
</dl>
<p>The user should have no privileges that result in it being
able to access files that are not intended to be visible to the
outside world, and similarly, the user should not be able to
execute code that is not meant for httpd requests. It is
recommended that you set up a new user and group specifically for
running the server. Some admins use user <code>nobody</code>, but
this is not always desirable, since the <code>nobody</code> user
can have other uses on the system.</p>
<p>Notes: If you start the server as a non-root user, it will
fail to change to the lesser privileged user, and will instead
continue to run as that original user. If you do start the
server as root, then it is normal for the parent process to
remain running as root.</p>
<p>Special note: Use of this directive in <code class="directive"><a href="../mod/core.html#virtualhost"><VirtualHost></a></code> is no longer supported. To
configure your server for <a href="mod_suexec.html">suexec</a> use
<code class="directive"><a href="../mod/mod_suexec.html#suexecusergroup">SuexecUserGroup</a></code>.</p>
<div class="note"><h3>Security</h3> <p>Don't set <code class="directive">User</code>
(or <code class="directive"><a href="#group">Group</a></code>) to
<code>root</code> unless you know exactly what you are doing, and what
the dangers are.</p></div>
</div></div><div id="footer"><p class="apache">Maintained by the <a href="http://httpd.apache.org/docs-project/">Apache HTTP Server Documentation Project</a></p><p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div></body></html>
|