1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
4
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
5
This file is generated from xml source: DO NOT EDIT
6
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
8
<title>mpm_common - Apache HTTP Server</title>
9
<link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
10
<link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
11
<link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
12
<link href="../images/favicon.ico" rel="shortcut icon" /></head>
14
<div id="page-header">
15
<p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p>
16
<p class="apache">Apache HTTP Server Version 2.2</p>
17
<img alt="" src="../images/feather.gif" /></div>
18
<div class="up"><a href="./"><img title="<-" alt="<-" src="../images/left.gif" /></a></div>
20
<a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs/">Documentation</a> > <a href="../">Version 2.2</a> > <a href="./">Modules</a></div>
21
<div id="page-content">
22
<div id="preamble"><h1>Apache MPM Common Directives</h1>
24
<p><span>Available Languages: </span><a href="../de/mod/mpm_common.html" hreflang="de" rel="alternate" title="Deutsch"> de </a> |
25
<a href="../en/mod/mpm_common.html" title="English"> en </a> |
26
<a href="../ja/mod/mpm_common.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a></p>
28
<table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>A collection of directives that are implemented by
29
more than one multi-processing module (MPM)</td></tr>
30
<tr><th><a href="module-dict.html#Status">Status:</a></th><td>MPM</td></tr></table>
32
<div id="quickview"><h3 class="directives">Directives</h3>
34
<li><img alt="" src="../images/down.gif" /> <a href="#acceptmutex">AcceptMutex</a></li>
35
<li><img alt="" src="../images/down.gif" /> <a href="#coredumpdirectory">CoreDumpDirectory</a></li>
36
<li><img alt="" src="../images/down.gif" /> <a href="#enableexceptionhook">EnableExceptionHook</a></li>
37
<li><img alt="" src="../images/down.gif" /> <a href="#gracefulshutdowntimeout">GracefulShutdownTimeout</a></li>
38
<li><img alt="" src="../images/down.gif" /> <a href="#group">Group</a></li>
39
<li><img alt="" src="../images/down.gif" /> <a href="#listen">Listen</a></li>
40
<li><img alt="" src="../images/down.gif" /> <a href="#listenbacklog">ListenBackLog</a></li>
41
<li><img alt="" src="../images/down.gif" /> <a href="#lockfile">LockFile</a></li>
42
<li><img alt="" src="../images/down.gif" /> <a href="#maxclients">MaxClients</a></li>
43
<li><img alt="" src="../images/down.gif" /> <a href="#maxmemfree">MaxMemFree</a></li>
44
<li><img alt="" src="../images/down.gif" /> <a href="#maxrequestsperchild">MaxRequestsPerChild</a></li>
45
<li><img alt="" src="../images/down.gif" /> <a href="#maxsparethreads">MaxSpareThreads</a></li>
46
<li><img alt="" src="../images/down.gif" /> <a href="#minsparethreads">MinSpareThreads</a></li>
47
<li><img alt="" src="../images/down.gif" /> <a href="#pidfile">PidFile</a></li>
48
<li><img alt="" src="../images/down.gif" /> <a href="#receivebuffersize">ReceiveBufferSize</a></li>
49
<li><img alt="" src="../images/down.gif" /> <a href="#scoreboardfile">ScoreBoardFile</a></li>
50
<li><img alt="" src="../images/down.gif" /> <a href="#sendbuffersize">SendBufferSize</a></li>
51
<li><img alt="" src="../images/down.gif" /> <a href="#serverlimit">ServerLimit</a></li>
52
<li><img alt="" src="../images/down.gif" /> <a href="#startservers">StartServers</a></li>
53
<li><img alt="" src="../images/down.gif" /> <a href="#startthreads">StartThreads</a></li>
54
<li><img alt="" src="../images/down.gif" /> <a href="#threadlimit">ThreadLimit</a></li>
55
<li><img alt="" src="../images/down.gif" /> <a href="#threadsperchild">ThreadsPerChild</a></li>
56
<li><img alt="" src="../images/down.gif" /> <a href="#threadstacksize">ThreadStackSize</a></li>
57
<li><img alt="" src="../images/down.gif" /> <a href="#user">User</a></li>
61
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
62
<div class="directive-section"><h2><a name="AcceptMutex" id="AcceptMutex">AcceptMutex</a> <a name="acceptmutex" id="acceptmutex">Directive</a></h2>
63
<table class="directive">
64
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Method that Apache uses to serialize multiple children
65
accepting requests on network sockets</td></tr>
66
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AcceptMutex Default|<var>method</var></code></td></tr>
67
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AcceptMutex Default</code></td></tr>
68
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
69
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
70
<tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
72
<p>The <code class="directive">AcceptMutex</code> directives sets the
73
method that Apache uses to serialize multiple children accepting
74
requests on network sockets. Prior to Apache 2.0, the method was
75
selectable only at compile time. The optimal method to use is
76
highly architecture and platform dependent. For further details,
77
see the <a href="../misc/perf-tuning.html">performance tuning</a>
80
<p>If this directive is set to <code>Default</code>, then the
81
compile-time selected default will be used. Other possible
82
methods are listed below. Note that not all methods are
83
available on all platforms. If a method is specified which is
84
not available, a message will be written to the error log
85
listing the available methods.</p>
88
<dt><code>flock</code></dt>
89
<dd>uses the <code>flock(2)</code> system call to lock the
90
file defined by the <code class="directive"><a href="#lockfile">LockFile</a></code> directive.</dd>
92
<dt><code>fcntl</code></dt>
93
<dd>uses the <code>fcntl(2)</code> system call to lock the
94
file defined by the <code class="directive"><a href="#lockfile">LockFile</a></code> directive.</dd>
96
<dt><code>posixsem</code></dt>
97
<dd>uses POSIX compatible semaphores to implement the mutex.</dd>
99
<dt><code>pthread</code></dt>
100
<dd>uses POSIX mutexes as implemented by the POSIX Threads
101
(PThreads) specification.</dd>
103
<dt><code>sysvsem</code></dt>
104
<dd>uses SySV-style semaphores to implement the mutex.</dd>
107
<p>If you want to find out the compile time chosen default
108
for your system, you may set your <code class="directive"><a href="../mod/core.html#loglevel">LogLevel</a></code> to <code>debug</code>. Then the default <code class="directive">AcceptMutex</code> will be written into the <code class="directive"><a href="../mod/core.html#errorlog">ErrorLog</a></code>.</p>
110
<div class="warning"><h3>Warning</h3>
111
<p>On most systems, when the <code>pthread</code> option
112
is selected, if a child process terminates abnormally
113
while holding the <code>AcceptCntl</code> mutex the
114
server will stop responding to requests. When this
115
occurs, the server will require a manual restart to
117
<p>Solaris is a notable exception as it provides a
118
mechanism, used by Apache, which usually allows the
119
mutex to be recovered after a child process terminates
120
abnormally while holding a mutex.</p>
121
<p>If your system implements the
122
<code>pthread_mutexattr_setrobust_np()</code> function,
123
you may be able to use the <code>pthread</code> option safely.</p>
127
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
128
<div class="directive-section"><h2><a name="CoreDumpDirectory" id="CoreDumpDirectory">CoreDumpDirectory</a> <a name="coredumpdirectory" id="coredumpdirectory">Directive</a></h2>
129
<table class="directive">
130
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Directory where Apache attempts to
131
switch before dumping core</td></tr>
132
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>CoreDumpDirectory <var>directory</var></code></td></tr>
133
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for the default setting</code></td></tr>
134
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
135
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
136
<tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/beos.html">beos</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
138
<p>This controls the directory to which Apache attempts to
139
switch before dumping core. The default is in the
140
<code class="directive"><a href="../mod/core.html#serverroot">ServerRoot</a></code> directory, however
141
since this should not be writable by the user the server runs
142
as, core dumps won't normally get written. If you want a core
143
dump for debugging, you can use this directive to place it in a
144
different location.</p>
146
<div class="note"><h3>Core Dumps on Linux</h3>
147
<p>If Apache starts as root and switches to another user, the
148
Linux kernel <em>disables</em> core dumps even if the directory is
149
writable for the process. Apache (2.0.46 and later) reenables core dumps
150
on Linux 2.4 and beyond, but only if you explicitly configure a <code class="directive">CoreDumpDirectory</code>.</p>
154
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
155
<div class="directive-section"><h2><a name="EnableExceptionHook" id="EnableExceptionHook">EnableExceptionHook</a> <a name="enableexceptionhook" id="enableexceptionhook">Directive</a></h2>
156
<table class="directive">
157
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enables a hook that runs exception handlers
158
after a crash</td></tr>
159
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>EnableExceptionHook On|Off</code></td></tr>
160
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>EnableExceptionHook Off</code></td></tr>
161
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
162
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
163
<tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
164
<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in version 2.0.49 and later</td></tr>
166
<p>For safety reasons this directive is only available if the server was
167
configured with the <code>--enable-exception-hook</code> option. It
168
enables a hook that allows external modules to plug in and do something
169
after a child crashed.</p>
171
<p>There are already two modules, <code>mod_whatkilledus</code> and
172
<code>mod_backtrace</code> that make use of this hook. Please have a
173
look at Jeff Trawick's <a href="http://www.apache.org/~trawick/exception_hook.html">EnableExceptionHook site</a> for more information about these.</p>
176
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
177
<div class="directive-section"><h2><a name="GracefulShutdownTimeout" id="GracefulShutdownTimeout">GracefulShutdownTimeout</a> <a name="gracefulshutdowntimeout" id="gracefulshutdowntimeout">Directive</a></h2>
178
<table class="directive">
179
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Specify a timeout after which a gracefully shutdown server
181
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>GracefulShutDownTimeout <var>seconds</var></code></td></tr>
182
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>GracefulShutDownTimeout 0</code></td></tr>
183
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
184
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
185
<tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/event.html">event</a></code></td></tr>
186
<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in version 2.2 and later</td></tr>
188
<p>The <code class="directive">GracefulShutdownTimeout</code> specifies
189
how many seconds after receiving a "graceful-stop" signal, a
190
server should continue to run, handling the existing connections.</p>
192
<p>Setting this value to zero means that the server will wait
193
indefinitely until all remaining requests have been fully served.</p>
196
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
197
<div class="directive-section"><h2><a name="Group" id="Group">Group</a> <a name="group" id="group">Directive</a></h2>
198
<table class="directive">
199
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Group under which the server will answer
201
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Group <var>unix-group</var></code></td></tr>
202
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>Group #-1</code></td></tr>
203
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
204
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
205
<tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/beos.html">beos</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
206
<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Only valid in global server config since Apache
209
<p>The <code class="directive">Group</code> directive sets the group under
210
which the server will answer requests. In order to use this
211
directive, the server must be run initially as <code>root</code>. If
212
you start the server as a non-root user, it will fail to change to the
213
specified group, and will instead continue to run as the group of the
214
original user. <var>Unix-group</var> is one of:</p>
217
<dt>A group name</dt>
218
<dd>Refers to the given group by name.</dd>
220
<dt><code>#</code> followed by a group number.</dt>
221
<dd>Refers to a group by its number.</dd>
224
<div class="example"><h3>Example</h3><p><code>
228
<p>It is recommended that you set up a new group specifically for
229
running the server. Some admins use user <code>nobody</code>,
230
but this is not always possible or desirable.</p>
232
<div class="warning"><h3>Security</h3>
233
<p>Don't set <code class="directive">Group</code> (or <code class="directive"><a href="#user">User</a></code>) to <code>root</code> unless
234
you know exactly what you are doing, and what the dangers are.</p>
237
<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
238
configure your server for <code class="program"><a href="../programs/suexec.html">suexec</a></code> use
239
<code class="directive"><a href="../mod/mod_suexec.html#suexecusergroup">SuexecUserGroup</a></code>.</p>
241
<div class="note"><h3>Note</h3>
242
<p>Although the <code class="directive">Group</code> directive is present
243
in the <code class="module"><a href="../mod/beos.html">beos</a></code> and <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code> MPMs,
244
it is actually a no-op there and only exists for compatibility
249
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
250
<div class="directive-section"><h2><a name="Listen" id="Listen">Listen</a> <a name="listen" id="listen">Directive</a></h2>
251
<table class="directive">
252
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>IP addresses and ports that the server
254
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Listen [<var>IP-address</var>:]<var>portnumber</var> [<var>protocol</var>]</code></td></tr>
255
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
256
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
257
<tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/beos.html">beos</a></code>, <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/event.html">event</a></code></td></tr>
258
<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Required directive since Apache 2.0<br />
259
The <var>protocol</var> argument was added in 2.1.5</td></tr>
261
<p>The <code class="directive">Listen</code> directive instructs Apache to
262
listen to only specific IP addresses or ports; by default it
263
responds to requests on all IP interfaces. <code class="directive">Listen</code>
264
is now a required directive. If it is not in the config file, the
265
server will fail to start. This is a change from previous versions
268
<p>The <code class="directive">Listen</code> directive tells the server to
269
accept incoming requests on the specified port or address-and-port
270
combination. If only a port number is specified, the server listens to
271
the given port on all interfaces. If an IP address is given as well
272
as a port, the server will listen on the given port and
275
<p>Multiple <code class="directive">Listen</code> directives may be used to
276
specify a number of addresses and ports to listen to. The server will
277
respond to requests from any of the listed addresses and ports.</p>
279
<p>For example, to make the server accept connections on both
280
port 80 and port 8000, use:</p>
282
<div class="example"><p><code>
287
<p>To make the server accept connections on two specified
288
interfaces and port numbers, use </p>
290
<div class="example"><p><code>
291
Listen 192.170.2.1:80<br />
292
Listen 192.170.2.5:8000
295
<p>IPv6 addresses must be surrounded in square brackets, as in the
296
following example:</p>
298
<div class="example"><p><code>
299
Listen [2001:db8::a00:20ff:fea7:ccea]:80
302
<p>The optional <var>protocol</var> argument is not required for most
303
configurations. If not specified, <code>https</code> is the default for
304
port 443 and <code>http</code> the default for all other ports. The
305
protocol is used to determine which module should handle a request, and
306
to apply protocol specific optimizations with the
307
<code class="directive"><a href="../mod/core.html#acceptfilter">AcceptFilter</a></code> directive.</p>
309
<p>You only need to set the protocol if you are running on non-standard
310
ports. For example, running an <code>https</code> site on port 8443:</p>
312
<div class="example"><p><code>
313
Listen 192.170.2.1:8443 https
316
<div class="note"><h3>Error condition</h3>
317
Multiple <code class="directive">Listen</code> directives for the same ip
318
address and port will result in an <code>Address already in use</code>
325
<li><a href="../dns-caveats.html">DNS Issues</a></li>
326
<li><a href="../bind.html">Setting which addresses and ports Apache
330
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
331
<div class="directive-section"><h2><a name="ListenBackLog" id="ListenBackLog">ListenBackLog</a> <a name="listenbacklog" id="listenbacklog">Directive</a></h2>
332
<table class="directive">
333
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maximum length of the queue of pending connections</td></tr>
334
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ListenBacklog <var>backlog</var></code></td></tr>
335
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ListenBacklog 511</code></td></tr>
336
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
337
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
338
<tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/beos.html">beos</a></code>, <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
340
<p>The maximum length of the queue of pending connections.
341
Generally no tuning is needed or desired, however on some
342
systems it is desirable to increase this when under a TCP SYN
343
flood attack. See the backlog parameter to the
344
<code>listen(2)</code> system call.</p>
346
<p>This will often be limited to a smaller number by the
347
operating system. This varies from OS to OS. Also note that
348
many OSes do not use exactly what is specified as the backlog,
349
but use a number based on (but normally larger than) what is
353
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
354
<div class="directive-section"><h2><a name="LockFile" id="LockFile">LockFile</a> <a name="lockfile" id="lockfile">Directive</a></h2>
355
<table class="directive">
356
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Location of the accept serialization lock file</td></tr>
357
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LockFile <var>filename</var></code></td></tr>
358
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LockFile logs/accept.lock</code></td></tr>
359
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
360
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
361
<tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
363
<p>The <code class="directive">LockFile</code> directive sets the path to
364
the lockfile used when Apache is used with an <code class="directive"><a href="#acceptmutex">AcceptMutex</a></code> value of either
365
<code>fcntl</code> or <code>flock</code>. This directive should
366
normally be left at its default value. The main reason for changing
367
it is if the <code>logs</code> directory is NFS mounted, since
368
<strong>the lockfile must be stored on a local disk</strong>. The PID
369
of the main server process is automatically appended to the
372
<div class="warning"><h3>Security</h3>
373
<p>It is best to <em>avoid</em> putting this file in a world writable
374
directory such as <code>/var/tmp</code> because someone could create
375
a denial of service attack and prevent the server from starting by
376
creating a lockfile with the same name as the one the server will try
382
<li><code class="directive"><a href="#acceptmutex">AcceptMutex</a></code></li>
385
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
386
<div class="directive-section"><h2><a name="MaxClients" id="MaxClients">MaxClients</a> <a name="maxclients" id="maxclients">Directive</a></h2>
387
<table class="directive">
388
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maximum number of child processes that will be created
389
to serve requests</td></tr>
390
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MaxClients <var>number</var></code></td></tr>
391
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr>
392
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
393
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
394
<tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/beos.html">beos</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
396
<p>The <code class="directive">MaxClients</code> directive sets the limit
397
on the number of simultaneous requests that will be served. Any
398
connection attempts over the <code class="directive">MaxClients</code>
399
limit will normally be queued, up to a number based on the
400
<code class="directive"><a href="#listenbacklog">ListenBacklog</a></code>
401
directive. Once a child process is freed at the end of a different
402
request, the connection will then be serviced.</p>
404
<p>For non-threaded servers (<em>i.e.</em>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>),
405
<code class="directive">MaxClients</code> translates into the maximum
406
number of child processes that will be launched to serve requests.
407
The default value is <code>256</code>; to increase it, you must also raise
408
<code class="directive"><a href="#serverlimit">ServerLimit</a></code>.</p>
410
<p>For threaded and hybrid servers (<em>e.g.</em> <code class="module"><a href="../mod/beos.html">beos</a></code>
411
or <code class="module"><a href="../mod/worker.html">worker</a></code>) <code class="directive">MaxClients</code> restricts
412
the total number of threads that will be available to serve clients.
413
The default value for <code class="module"><a href="../mod/beos.html">beos</a></code> is <code>50</code>. For
414
hybrid MPMs the default value is <code>16</code> (<code class="directive"><a href="#serverlimit">ServerLimit</a></code>) multiplied by the value of
415
<code>25</code> (<code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code>). Therefore, to increase <code class="directive">MaxClients</code> to a value that requires more than 16 processes,
416
you must also raise <code class="directive"><a href="#serverlimit">ServerLimit</a></code>.</p>
419
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
420
<div class="directive-section"><h2><a name="MaxMemFree" id="MaxMemFree">MaxMemFree</a> <a name="maxmemfree" id="maxmemfree">Directive</a></h2>
421
<table class="directive">
422
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maximum amount of memory that the main allocator is allowed
423
to hold without calling <code>free()</code></td></tr>
424
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MaxMemFree <var>KBytes</var></code></td></tr>
425
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MaxMemFree 0</code></td></tr>
426
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
427
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
428
<tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/beos.html">beos</a></code>, <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code></td></tr>
430
<p>The <code class="directive">MaxMemFree</code> directive sets the
431
maximum number of free Kbytes that the main allocator is allowed
432
to hold without calling <code>free()</code>. When not set, or when set
433
to zero, the threshold will be set to unlimited.</p>
436
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
437
<div class="directive-section"><h2><a name="MaxRequestsPerChild" id="MaxRequestsPerChild">MaxRequestsPerChild</a> <a name="maxrequestsperchild" id="maxrequestsperchild">Directive</a></h2>
438
<table class="directive">
439
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limit on the number of requests that an individual child server
440
will handle during its life</td></tr>
441
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MaxRequestsPerChild <var>number</var></code></td></tr>
442
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MaxRequestsPerChild 10000</code></td></tr>
443
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
444
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
445
<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/mpm_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
447
<p>The <code class="directive">MaxRequestsPerChild</code> directive sets
448
the limit on the number of requests that an individual child
449
server process will handle. After
450
<code class="directive">MaxRequestsPerChild</code> requests, the child
451
process will die. If <code class="directive">MaxRequestsPerChild</code> is
452
<code>0</code>, then the process will never expire.</p>
454
<div class="note"><h3>Different default values</h3>
455
<p>The default value for <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code> and
456
<code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code> is <code>0</code>.</p>
459
<p>Setting <code class="directive">MaxRequestsPerChild</code> to a
460
non-zero limit has two beneficial effects:</p>
463
<li>it limits the amount of memory that process can consume
464
by (accidental) memory leakage;</li>
466
<li>by giving processes a finite lifetime, it helps reduce
467
the number of processes when the server load reduces.</li>
470
<div class="note"><h3>Note</h3>
471
<p>For <code class="directive"><a href="../mod/core.html#keepalive">KeepAlive</a></code> requests, only
472
the first request is counted towards this limit. In effect, it
473
changes the behavior to limit the number of <em>connections</em> per
478
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
479
<div class="directive-section"><h2><a name="MaxSpareThreads" id="MaxSpareThreads">MaxSpareThreads</a> <a name="maxsparethreads" id="maxsparethreads">Directive</a></h2>
480
<table class="directive">
481
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maximum number of idle threads</td></tr>
482
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MaxSpareThreads <var>number</var></code></td></tr>
483
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr>
484
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
485
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
486
<tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/beos.html">beos</a></code>, <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
488
<p>Maximum number of idle threads. Different MPMs deal with this
489
directive differently.</p>
491
<p>For <code class="module"><a href="../mod/worker.html">worker</a></code>,
492
the default is <code>MaxSpareThreads 250</code>.
493
These MPMs deal with idle threads on a server-wide basis. If there
494
are too many idle threads in the server then child processes are
495
killed until the number of idle threads is less than this number.</p>
497
<p>For <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code> the default is
498
<code>MaxSpareThreads 100</code>. Since this MPM runs a
499
single-process, the spare thread count is also server-wide.</p>
501
<p><code class="module"><a href="../mod/beos.html">beos</a></code> and <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code> work
502
similar to <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>. The default for
503
<code class="module"><a href="../mod/beos.html">beos</a></code> is <code>MaxSpareThreads 50</code>. For
504
<code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code> the default value is <code>10</code>.</p>
506
<div class="note"><h3>Restrictions</h3>
507
<p>The range of the <code class="directive">MaxSpareThreads</code> value
508
is restricted. Apache will correct the given value automatically
509
according to the following rules:</p>
512
<li><code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code> wants the value to be greater than
513
<code class="directive"><a href="#minsparethreads">MinSpareThreads</a></code>.</li>
516
<code class="module"><a href="../mod/worker.html">worker</a></code> the value must be greater or equal than
517
the sum of <code class="directive"><a href="#minsparethreads">MinSpareThreads</a></code>
518
and <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code>.</li>
524
<li><code class="directive"><a href="#minsparethreads">MinSpareThreads</a></code></li>
525
<li><code class="directive"><a href="#startservers">StartServers</a></code></li>
528
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
529
<div class="directive-section"><h2><a name="MinSpareThreads" id="MinSpareThreads">MinSpareThreads</a> <a name="minsparethreads" id="minsparethreads">Directive</a></h2>
530
<table class="directive">
531
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Minimum number of idle threads available to handle request
533
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MinSpareThreads <var>number</var></code></td></tr>
534
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr>
535
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
536
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
537
<tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/beos.html">beos</a></code>, <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
539
<p>Minimum number of idle threads to handle request spikes.
540
Different MPMs deal with this directive
544
<p><code class="module"><a href="../mod/worker.html">worker</a></code>
545
uses a default of <code>MinSpareThreads
546
75</code> and deal with idle threads on a server-wide basis. If
547
there aren't enough idle threads in the server then child
548
processes are created until the number of idle threads is greater
551
<p><code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code> uses a default of
552
<code>MinSpareThreads 10</code> and, since it is a single-process
553
MPM, tracks this on a server-wide bases.</p>
555
<p><code class="module"><a href="../mod/beos.html">beos</a></code> and <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code> work
556
similar to <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>. The default for
557
<code class="module"><a href="../mod/beos.html">beos</a></code> is <code>MinSpareThreads 1</code>. For
558
<code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code> the default value is <code>5</code>.</p>
562
<li><code class="directive"><a href="#maxsparethreads">MaxSpareThreads</a></code></li>
563
<li><code class="directive"><a href="#startservers">StartServers</a></code></li>
566
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
567
<div class="directive-section"><h2><a name="PidFile" id="PidFile">PidFile</a> <a name="pidfile" id="pidfile">Directive</a></h2>
568
<table class="directive">
569
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>File where the server records the process ID
570
of the daemon</td></tr>
571
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>PidFile <var>filename</var></code></td></tr>
572
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>PidFile logs/httpd.pid</code></td></tr>
573
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
574
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
575
<tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/beos.html">beos</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
577
<p>The <code class="directive">PidFile</code> directive sets the file to
578
which the server records the process id of the daemon. If the
579
filename is not absolute then it is assumed to be relative to the
580
<code class="directive"><a href="../mod/core.html#serverroot">ServerRoot</a></code>.</p>
582
<div class="example"><h3>Example</h3><p><code>
583
PidFile /var/run/apache.pid
586
<p>It is often useful to be able to send the server a signal,
587
so that it closes and then re-opens its <code class="directive"><a href="../mod/core.html#errorlog">ErrorLog</a></code> and <code class="directive"><a href="../mod/mod_log_config.html#transferlog">TransferLog</a></code>, and
588
re-reads its configuration files. This is done by sending a
589
SIGHUP (kill -1) signal to the process id listed in the
590
<code class="directive">PidFile</code>.</p>
592
<p>The <code class="directive">PidFile</code> is subject to the same
593
warnings about log file placement and <a href="../misc/security_tips.html#serverroot">security</a>.</p>
595
<div class="note"><h3>Note</h3>
596
<p>As of Apache 2 it is recommended to use only the <code class="program"><a href="../programs/apachectl.html">apachectl</a></code> script for (re-)starting or stopping the server.</p>
600
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
601
<div class="directive-section"><h2><a name="ReceiveBufferSize" id="ReceiveBufferSize">ReceiveBufferSize</a> <a name="receivebuffersize" id="receivebuffersize">Directive</a></h2>
602
<table class="directive">
603
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>TCP receive buffer size</td></tr>
604
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ReceiveBufferSize <var>bytes</var></code></td></tr>
605
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ReceiveBufferSize 0</code></td></tr>
606
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
607
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
608
<tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/beos.html">beos</a></code>, <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
610
<p>The server will set the TCP receive buffer size to the number of
613
<p>If set to the value of <code>0</code>, the server will use the
617
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
618
<div class="directive-section"><h2><a name="ScoreBoardFile" id="ScoreBoardFile">ScoreBoardFile</a> <a name="scoreboardfile" id="scoreboardfile">Directive</a></h2>
619
<table class="directive">
620
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Location of the file used to store coordination data for
621
the child processes</td></tr>
622
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ScoreBoardFile <var>file-path</var></code></td></tr>
623
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ScoreBoardFile logs/apache_status</code></td></tr>
624
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
625
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
626
<tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/beos.html">beos</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
628
<p>Apache uses a scoreboard to communicate between its parent
629
and child processes. Some architectures require a file to facilitate
630
this communication. If the file is left unspecified, Apache first
631
attempts to create the scoreboard entirely in memory (using anonymous
632
shared memory) and, failing that, will attempt to create the file on
633
disk (using file-based shared memory). Specifying this directive causes
634
Apache to always create the file on the disk.</p>
636
<div class="example"><h3>Example</h3><p><code>
637
ScoreBoardFile /var/run/apache_status
640
<p>File-based shared memory is useful for third-party applications
641
that require direct access to the scoreboard.</p>
643
<p>If you use a <code class="directive">ScoreBoardFile</code> then
644
you may see improved speed by placing it on a RAM disk. But be
645
careful that you heed the same warnings about log file placement
646
and <a href="../misc/security_tips.html">security</a>.</p>
650
<li><a href="../stopping.html">Stopping and Restarting
654
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
655
<div class="directive-section"><h2><a name="SendBufferSize" id="SendBufferSize">SendBufferSize</a> <a name="sendbuffersize" id="sendbuffersize">Directive</a></h2>
656
<table class="directive">
657
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>TCP buffer size</td></tr>
658
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SendBufferSize <var>bytes</var></code></td></tr>
659
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>SendBufferSize 0</code></td></tr>
660
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
661
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
662
<tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/beos.html">beos</a></code>, <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
664
<p>The server will set the TCP send buffer size to the number of bytes
665
specified. Very useful to increase past standard OS defaults on
666
high speed high latency (<em>i.e.</em>, 100ms or so, such as
667
transcontinental fast pipes).</p>
669
<p>If set to the value of <code>0</code>, the server will use the
673
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
674
<div class="directive-section"><h2><a name="ServerLimit" id="ServerLimit">ServerLimit</a> <a name="serverlimit" id="serverlimit">Directive</a></h2>
675
<table class="directive">
676
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Upper limit on configurable number of processes</td></tr>
677
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerLimit <var>number</var></code></td></tr>
678
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr>
679
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
680
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
681
<tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
683
<p>For the <code class="module"><a href="../mod/prefork.html">prefork</a></code> MPM, this directive sets the
684
maximum configured value for <code class="directive"><a href="#maxclients">MaxClients</a></code> for the lifetime of the
685
Apache process. For the <code class="module"><a href="../mod/worker.html">worker</a></code> MPM, this directive
686
in combination with <code class="directive"><a href="#threadlimit">ThreadLimit</a></code> sets
687
the maximum configured value for <code class="directive"><a href="#maxclients">MaxClients</a></code> for the lifetime of the
688
Apache process. Any attempts to change this directive during a
689
restart will be ignored, but <code class="directive"><a href="#maxclients">MaxClients</a></code> can be modified during
692
<p>Special care must be taken when using this directive. If
693
<code class="directive">ServerLimit</code> is set to a value much higher
694
than necessary, extra, unused shared memory will be allocated. If
695
both <code class="directive">ServerLimit</code> and <code class="directive"><a href="#maxclients">MaxClients</a></code> are set to values
696
higher than the system can handle, Apache may not start or the
697
system may become unstable.</p>
699
<p>With the <code class="module"><a href="../mod/prefork.html">prefork</a></code> MPM, use this directive only
700
if you need to set <code class="directive"><a href="#maxclients">MaxClients</a></code> higher than 256 (default).
701
Do not set the value of this directive any higher than what you
702
might want to set <code class="directive"><a href="#maxclients">MaxClients</a></code> to.</p>
704
<p>With <code class="module"><a href="../mod/worker.html">worker</a></code>
705
use this directive only
706
if your <code class="directive"><a href="#maxclients">MaxClients</a></code> and
707
<code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code>
708
settings require more than 16 server processes (default). Do not set
709
the value of this directive any higher than the number of server
710
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>
712
<div class="note"><h3>Note</h3>
713
<p>There is a hard limit of <code>ServerLimit 20000</code> compiled
714
into the server (for the <code class="module"><a href="../mod/prefork.html">prefork</a></code> MPM 200000). This is
715
intended to avoid nasty effects caused by typos.</p>
720
<li><a href="../stopping.html">Stopping and Restarting Apache</a></li>
723
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
724
<div class="directive-section"><h2><a name="StartServers" id="StartServers">StartServers</a> <a name="startservers" id="startservers">Directive</a></h2>
725
<table class="directive">
726
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Number of child server processes created at startup</td></tr>
727
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>StartServers <var>number</var></code></td></tr>
728
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr>
729
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
730
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
731
<tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
733
<p>The <code class="directive">StartServers</code> directive sets the
734
number of child server processes created on startup. As the number
735
of processes is dynamically controlled depending on the load,
736
there is usually little reason to adjust this parameter.</p>
738
<p>The default value differs from MPM to MPM. For
739
<code class="module"><a href="../mod/worker.html">worker</a></code> the default is <code>StartServers 3</code>.
740
For <code class="module"><a href="../mod/prefork.html">prefork</a></code> defaults to <code>5</code> and for
741
<code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code> to <code>2</code>.</p>
744
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
745
<div class="directive-section"><h2><a name="StartThreads" id="StartThreads">StartThreads</a> <a name="startthreads" id="startthreads">Directive</a></h2>
746
<table class="directive">
747
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Number of threads created on startup</td></tr>
748
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>StartThreads <var>number</var></code></td></tr>
749
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr>
750
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
751
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
752
<tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/beos.html">beos</a></code>, <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code></td></tr>
754
<p>Number of threads created on startup. As the
755
number of threads is dynamically controlled depending on the
756
load, there is usually little reason to adjust this
759
<p>For <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code> the default is
760
<code>StartThreads 50</code> and, since there is only a single
761
process, this is the total number of threads created at startup to
764
<p>For <code class="module"><a href="../mod/beos.html">beos</a></code> the default is <code>StartThreads
765
10</code>. It also reflects the total number of threads created
766
at startup to serve requests.</p>
769
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
770
<div class="directive-section"><h2><a name="ThreadLimit" id="ThreadLimit">ThreadLimit</a> <a name="threadlimit" id="threadlimit">Directive</a></h2>
771
<table class="directive">
772
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets the upper limit on the configurable number of threads
773
per child process</td></tr>
774
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ThreadLimit <var>number</var></code></td></tr>
775
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr>
776
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
777
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
778
<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>
779
<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available for <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code> in Apache 2.0.41
782
<p>This directive sets the maximum configured value for <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code> for the lifetime
783
of the Apache process. Any attempts to change this directive
784
during a restart will be ignored, but <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code> can be modified
785
during a restart up to the value of this directive.</p>
787
<p>Special care must be taken when using this directive. If
788
<code class="directive">ThreadLimit</code> is set to a value much higher
789
than <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code>,
790
extra unused shared memory will be allocated. If both
791
<code class="directive">ThreadLimit</code> and <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code> are set to values
792
higher than the system can handle, Apache may not start or the
793
system may become unstable. Do not set the value of this directive
794
any higher than your greatest predicted setting of <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code> for the
795
current run of Apache.</p>
797
<p>The default value for <code class="directive">ThreadLimit</code> is
798
<code>1920</code> when used with <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code> and
799
<code>64</code> when used with the others.</p>
801
<div class="note"><h3>Note</h3>
802
<p>There is a hard limit of <code>ThreadLimit 20000</code> (or
803
<code>ThreadLimit 15000</code> with <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>)
804
compiled into the server. This is intended to avoid nasty effects
809
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
810
<div class="directive-section"><h2><a name="ThreadsPerChild" id="ThreadsPerChild">ThreadsPerChild</a> <a name="threadsperchild" id="threadsperchild">Directive</a></h2>
811
<table class="directive">
812
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Number of threads created by each child process</td></tr>
813
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ThreadsPerChild <var>number</var></code></td></tr>
814
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr>
815
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
816
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
817
<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>
819
<p>This directive sets the number of threads created by each
820
child process. The child creates these threads at startup and
821
never creates more. If using an MPM like <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>,
822
where there is only one child process, this number should be high
823
enough to handle the entire load of the server. If using an MPM
824
like <code class="module"><a href="../mod/worker.html">worker</a></code>, where there are multiple child processes,
825
the <em>total</em> number of threads should be high enough to handle
826
the common load on the server.</p>
828
<p>The default value for <code class="directive">ThreadsPerChild</code> is
829
<code>64</code> when used with <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code> and
830
<code>25</code> when used with the others.</p>
833
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
834
<div class="directive-section"><h2><a name="ThreadStackSize" id="ThreadStackSize">ThreadStackSize</a> <a name="threadstacksize" id="threadstacksize">Directive</a></h2>
835
<table class="directive">
836
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>The size in bytes of the stack used by threads handling
837
client connections</td></tr>
838
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ThreadStackSize <var>size</var></code></td></tr>
839
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>65536 on NetWare; varies on other operating systems</code></td></tr>
840
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
841
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
842
<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/mpm_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
843
<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.1 and later</td></tr>
845
<p>The <code class="directive">ThreadStackSize</code> directive sets the
846
size of the stack (for autodata) of threads which handle client
847
connections and call modules to help process those connections.
848
In most cases the operating system default for stack size is
849
reasonable, but there are some conditions where it may need to be
853
<li>On platforms with a relatively small default thread stack size
854
(e.g., HP-UX), Apache may crash when using some third-party modules
855
which use a relatively large amount of autodata storage. Those
856
same modules may have worked fine on other platforms where the
857
default thread stack size is larger. This type of crash is
858
resolved by setting <code class="directive">ThreadStackSize</code> to a
859
value higher than the operating system default. This type of
860
adjustment is necessary only if the provider of the third-party
861
module specifies that it is required, or if diagnosis of an Apache
862
crash indicates that the thread stack size was too small.</li>
864
<li>On platforms where the default thread stack size is
865
significantly larger than necessary for the web server
866
configuration, a higher number of threads per child process
867
will be achievable if <code class="directive">ThreadStackSize</code> is
868
set to a value lower than the operating system default. This type
869
of adjustment should only be made in a test environment which allows
870
the full set of web server processing can be exercised, as there
871
may be infrequent requests which require more stack to process.
872
A change in the web server configuration can invalidate the
873
current <code class="directive">ThreadStackSize</code> setting.</li>
877
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
878
<div class="directive-section"><h2><a name="User" id="User">User</a> <a name="user" id="user">Directive</a></h2>
879
<table class="directive">
880
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>The userid under which the server will answer
882
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>User <var>unix-userid</var></code></td></tr>
883
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>User #-1</code></td></tr>
884
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
885
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
886
<tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code></td></tr>
887
<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Only valid in global server config since Apache
890
<p>The <code class="directive">User</code> directive sets the user ID as
891
which the server will answer requests. In order to use this
892
directive, the server must be run initially as <code>root</code>.
893
If you start the server as a non-root user, it will fail to change
894
to the lesser privileged user, and will instead continue to run as
895
that original user. If you do start the server as <code>root</code>,
896
then it is normal for the parent process to remain running as root.
897
<var>Unix-userid</var> is one of:</p>
901
<dd>Refers to the given user by name.</dd>
903
<dt># followed by a user number.</dt>
904
<dd>Refers to a user by its number.</dd>
907
<p>The user should have no privileges that result in it being
908
able to access files that are not intended to be visible to the
909
outside world, and similarly, the user should not be able to
910
execute code that is not meant for HTTP requests. It is
911
recommended that you set up a new user and group specifically for
912
running the server. Some admins use user <code>nobody</code>, but
913
this is not always desirable, since the <code>nobody</code> user
914
can have other uses on the system.</p>
916
<div class="warning"><h3>Security</h3>
917
<p>Don't set <code class="directive">User</code> (or <code class="directive"><a href="#group">Group</a></code>) to <code>root</code> unless
918
you know exactly what you are doing, and what the dangers are.</p>
921
<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
922
configure your server for <code class="program"><a href="../programs/suexec.html">suexec</a></code> use
923
<code class="directive"><a href="../mod/mod_suexec.html#suexecusergroup">SuexecUserGroup</a></code>.</p>
925
<div class="note"><h3>Note</h3>
926
<p>Although the <code class="directive">User</code> directive is present
927
in the <code class="module"><a href="../mod/beos.html">beos</a></code> and <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code> MPMs,
928
it is actually a no-op there and only exists for compatibility
934
<div class="bottomlang">
935
<p><span>Available Languages: </span><a href="../de/mod/mpm_common.html" hreflang="de" rel="alternate" title="Deutsch"> de </a> |
936
<a href="../en/mod/mpm_common.html" title="English"> en </a> |
937
<a href="../ja/mod/mpm_common.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a></p>
938
</div><div id="footer">
939
<p class="apache">Copyright 2006 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
940
<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>
b'\\ No newline at end of file'