github.com/krum110487/go-htaccess@v0.0.0-20240316004156-60641c8e7598/tests/data/apache_2_2_34/manual/mod/mpm_common.html.en (about) 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 <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type" /> 5 <!-- 6 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 7 This file is generated from xml source: DO NOT EDIT 8 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 9 --> 10 <title>mpm_common - Apache HTTP Server Version 2.2</title> 11 <link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" /> 12 <link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" /> 13 <link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link rel="stylesheet" type="text/css" href="../style/css/prettify.css" /> 14 <script src="../style/scripts/prettify.min.js" type="text/javascript"> 15 </script> 16 17 <link href="../images/favicon.ico" rel="shortcut icon" /><link href="http://httpd.apache.org/docs/current/mod/mpm_common.html" rel="canonical" /></head> 18 <body> 19 <div id="page-header"> 20 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p> 21 <p class="apache">Apache HTTP Server Version 2.2</p> 22 <img alt="" src="../images/feather.gif" /></div> 23 <div class="up"><a href="./"><img title="<-" alt="<-" src="../images/left.gif" /></a></div> 24 <div id="path"> 25 <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> 26 <div id="page-content"> 27 <div class="retired"><h4>Please note</h4> 28 <p> This document refers to a legacy release (<strong>2.2</strong>) of Apache httpd. The active release (<strong>2.4</strong>) is documented <a href="http://httpd.apache.org/docs/current">here</a>. If you have not already upgraded, please follow <a href="http://httpd.apache.org/docs/current/upgrading.html">this link</a> for more information.</p> 29 <p>You may follow <a href="http://httpd.apache.org/docs/current/mod/mpm_common.html">this link</a> to go to the current version of this document.</p></div><div id="preamble"><h1>Apache MPM Common Directives</h1> 30 <div class="toplang"> 31 <p><span>Available Languages: </span><a href="../de/mod/mpm_common.html" hreflang="de" rel="alternate" title="Deutsch"> de </a> | 32 <a href="../en/mod/mpm_common.html" title="English"> en </a> | 33 <a href="../ja/mod/mpm_common.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> | 34 <a href="../tr/mod/mpm_common.html" hreflang="tr" rel="alternate" title="Türkçe"> tr </a></p> 35 </div> 36 <table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>A collection of directives that are implemented by 37 more than one multi-processing module (MPM)</td></tr> 38 <tr><th><a href="module-dict.html#Status">Status:</a></th><td>MPM</td></tr></table> 39 </div> 40 <div id="quickview"><h3 class="directives">Directives</h3> 41 <ul id="toc"> 42 <li><img alt="" src="../images/down.gif" /> <a href="#acceptmutex">AcceptMutex</a></li> 43 <li><img alt="" src="../images/down.gif" /> <a href="#chrootdir">ChrootDir</a></li> 44 <li><img alt="" src="../images/down.gif" /> <a href="#coredumpdirectory">CoreDumpDirectory</a></li> 45 <li><img alt="" src="../images/down.gif" /> <a href="#enableexceptionhook">EnableExceptionHook</a></li> 46 <li><img alt="" src="../images/down.gif" /> <a href="#gracefulshutdowntimeout">GracefulShutdownTimeout</a></li> 47 <li><img alt="" src="../images/down.gif" /> <a href="#group">Group</a></li> 48 <li><img alt="" src="../images/down.gif" /> <a href="#listen">Listen</a></li> 49 <li><img alt="" src="../images/down.gif" /> <a href="#listenbacklog">ListenBackLog</a></li> 50 <li><img alt="" src="../images/down.gif" /> <a href="#lockfile">LockFile</a></li> 51 <li><img alt="" src="../images/down.gif" /> <a href="#maxclients">MaxClients</a></li> 52 <li><img alt="" src="../images/down.gif" /> <a href="#maxmemfree">MaxMemFree</a></li> 53 <li><img alt="" src="../images/down.gif" /> <a href="#maxrequestsperchild">MaxRequestsPerChild</a></li> 54 <li><img alt="" src="../images/down.gif" /> <a href="#maxsparethreads">MaxSpareThreads</a></li> 55 <li><img alt="" src="../images/down.gif" /> <a href="#minsparethreads">MinSpareThreads</a></li> 56 <li><img alt="" src="../images/down.gif" /> <a href="#pidfile">PidFile</a></li> 57 <li><img alt="" src="../images/down.gif" /> <a href="#receivebuffersize">ReceiveBufferSize</a></li> 58 <li><img alt="" src="../images/down.gif" /> <a href="#scoreboardfile">ScoreBoardFile</a></li> 59 <li><img alt="" src="../images/down.gif" /> <a href="#sendbuffersize">SendBufferSize</a></li> 60 <li><img alt="" src="../images/down.gif" /> <a href="#serverlimit">ServerLimit</a></li> 61 <li><img alt="" src="../images/down.gif" /> <a href="#startservers">StartServers</a></li> 62 <li><img alt="" src="../images/down.gif" /> <a href="#startthreads">StartThreads</a></li> 63 <li><img alt="" src="../images/down.gif" /> <a href="#threadlimit">ThreadLimit</a></li> 64 <li><img alt="" src="../images/down.gif" /> <a href="#threadsperchild">ThreadsPerChild</a></li> 65 <li><img alt="" src="../images/down.gif" /> <a href="#threadstacksize">ThreadStackSize</a></li> 66 <li><img alt="" src="../images/down.gif" /> <a href="#user">User</a></li> 67 </ul> 68 <ul class="seealso"><li><a href="#comments_section">Comments</a></li></ul></div> 69 70 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> 71 <div class="directive-section"><h2><a name="AcceptMutex" id="AcceptMutex">AcceptMutex</a> <a name="acceptmutex" id="acceptmutex">Directive</a></h2> 72 <table class="directive"> 73 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Method that Apache uses to serialize multiple children 74 accepting requests on network sockets</td></tr> 75 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AcceptMutex Default|<var>method</var></code></td></tr> 76 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AcceptMutex Default</code></td></tr> 77 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr> 78 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr> 79 <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> 80 </table> 81 <p>The <code class="directive">AcceptMutex</code> directives sets the 82 method that Apache uses to serialize multiple children accepting 83 requests on network sockets. Prior to Apache 2.0, the method was 84 selectable only at compile time. The optimal method to use is 85 highly architecture and platform dependent. For further details, 86 see the <a href="../misc/perf-tuning.html">performance tuning</a> 87 documentation.</p> 88 89 <p>If this directive is set to <code>Default</code>, then the 90 compile-time selected default will be used. Other possible 91 methods are listed below. Note that not all methods are 92 available on all platforms. If a method is specified which is 93 not available, a message will be written to the error log 94 listing the available methods.</p> 95 96 <dl> 97 <dt><code>flock</code></dt> 98 <dd>uses the <code>flock(2)</code> system call to lock the 99 file defined by the <code class="directive"><a href="#lockfile">LockFile</a></code> directive.</dd> 100 101 <dt><code>fcntl</code></dt> 102 <dd>uses the <code>fcntl(2)</code> system call to lock the 103 file defined by the <code class="directive"><a href="#lockfile">LockFile</a></code> directive.</dd> 104 105 <dt><code>posixsem</code></dt> 106 <dd>uses POSIX compatible semaphores to implement the mutex.</dd> 107 108 <dt><code>pthread</code></dt> 109 <dd>uses POSIX mutexes as implemented by the POSIX Threads 110 (PThreads) specification.</dd> 111 112 <dt><code>sysvsem</code></dt> 113 <dd>uses SySV-style semaphores to implement the mutex.</dd> 114 </dl> 115 116 <p>If you want to find out the compile time chosen default 117 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> 118 119 <div class="warning"><h3>Warning</h3> 120 <p>On most systems, when the <code>pthread</code> option 121 is selected, if a child process terminates abnormally 122 while holding the <code>AcceptCntl</code> mutex the 123 server will stop responding to requests. When this 124 occurs, the server will require a manual restart to 125 recover.</p> 126 <p>Solaris is a notable exception as it provides a 127 mechanism, used by Apache, which usually allows the 128 mutex to be recovered after a child process terminates 129 abnormally while holding a mutex.</p> 130 <p>If your system implements the 131 <code>pthread_mutexattr_setrobust_np()</code> function, 132 you may be able to use the <code>pthread</code> option safely.</p> 133 </div> 134 135 </div> 136 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> 137 <div class="directive-section"><h2><a name="ChrootDir" id="ChrootDir">ChrootDir</a> <a name="chrootdir" id="chrootdir">Directive</a></h2> 138 <table class="directive"> 139 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Directory for apache to run chroot(8) after startup.</td></tr> 140 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ChrootDir <var>/path/to/directory</var></code></td></tr> 141 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>none</code></td></tr> 142 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr> 143 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr> 144 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</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> 145 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.2.10 and later</td></tr> 146 </table> 147 <p>This directive tells the server to <var>chroot(8)</var> to the 148 specified directory after startup, but before accepting requests.</p> 149 150 <p>Note that running the server under chroot is not 151 simple, and requires additional setup, particularly if you are running 152 scripts such as CGI or PHP. Please make sure you are properly familiar 153 with the operation of chroot before attempting to use this feature.</p> 154 155 </div> 156 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> 157 <div class="directive-section"><h2><a name="CoreDumpDirectory" id="CoreDumpDirectory">CoreDumpDirectory</a> <a name="coredumpdirectory" id="coredumpdirectory">Directive</a></h2> 158 <table class="directive"> 159 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Directory where Apache attempts to 160 switch before dumping core</td></tr> 161 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>CoreDumpDirectory <var>directory</var></code></td></tr> 162 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for the default setting</code></td></tr> 163 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr> 164 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr> 165 <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> 166 </table> 167 <p>This controls the directory to which Apache attempts to 168 switch before dumping core. The default is in the 169 <code class="directive"><a href="../mod/core.html#serverroot">ServerRoot</a></code> directory, however 170 since this should not be writable by the user the server runs 171 as, core dumps won't normally get written. If you want a core 172 dump for debugging, you can use this directive to place it in a 173 different location.</p> 174 175 <div class="note"><h3>Core Dumps on Linux</h3> 176 <p>If Apache starts as root and switches to another user, the 177 Linux kernel <em>disables</em> core dumps even if the directory is 178 writable for the process. Apache (2.0.46 and later) reenables core dumps 179 on Linux 2.4 and beyond, but only if you explicitly configure a <code class="directive">CoreDumpDirectory</code>.</p> 180 </div> 181 182 <div class="note"><h3>Core Dumps on BSD</h3> 183 <p>To enable core-dumping of suid-executables on BSD-systems (such 184 as FreeBSD), set <code>kern.sugid_coredump</code> to 1. 185 </p></div> 186 187 188 </div> 189 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> 190 <div class="directive-section"><h2><a name="EnableExceptionHook" id="EnableExceptionHook">EnableExceptionHook</a> <a name="enableexceptionhook" id="enableexceptionhook">Directive</a></h2> 191 <table class="directive"> 192 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enables a hook that runs exception handlers 193 after a crash</td></tr> 194 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>EnableExceptionHook On|Off</code></td></tr> 195 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>EnableExceptionHook Off</code></td></tr> 196 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr> 197 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr> 198 <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> 199 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in version 2.0.49 and later</td></tr> 200 </table> 201 <p>For safety reasons this directive is only available if the server was 202 configured with the <code>--enable-exception-hook</code> option. It 203 enables a hook that allows external modules to plug in and do something 204 after a child crashed.</p> 205 206 <p>There are already two modules, <code>mod_whatkilledus</code> and 207 <code>mod_backtrace</code> that make use of this hook. Please have a 208 look at Jeff Trawick's <a href="http://www.apache.org/~trawick/exception_hook.html">EnableExceptionHook site</a> for more information about these.</p> 209 210 </div> 211 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> 212 <div class="directive-section"><h2><a name="GracefulShutdownTimeout" id="GracefulShutdownTimeout">GracefulShutdownTimeout</a> <a name="gracefulshutdowntimeout" id="gracefulshutdowntimeout">Directive</a></h2> 213 <table class="directive"> 214 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Specify a timeout after which a gracefully shutdown server 215 will exit.</td></tr> 216 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>GracefulShutDownTimeout <var>seconds</var></code></td></tr> 217 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>GracefulShutDownTimeout 0</code></td></tr> 218 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr> 219 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr> 220 <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> 221 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in version 2.2 and later</td></tr> 222 </table> 223 <p>The <code class="directive">GracefulShutdownTimeout</code> specifies 224 how many seconds after receiving a "graceful-stop" signal, a 225 server should continue to run, handling the existing connections.</p> 226 227 <p>Setting this value to zero means that the server will wait 228 indefinitely until all remaining requests have been fully served.</p> 229 230 </div> 231 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> 232 <div class="directive-section"><h2><a name="Group" id="Group">Group</a> <a name="group" id="group">Directive</a></h2> 233 <table class="directive"> 234 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Group under which the server will answer 235 requests</td></tr> 236 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Group <var>unix-group</var></code></td></tr> 237 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>Group #-1</code></td></tr> 238 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr> 239 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr> 240 <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> 241 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Only valid in global server config since Apache 242 2.0</td></tr> 243 </table> 244 <p>The <code class="directive">Group</code> directive sets the group under 245 which the server will answer requests. In order to use this 246 directive, the server must be run initially as <code>root</code>. If 247 you start the server as a non-root user, it will fail to change to the 248 specified group, and will instead continue to run as the group of the 249 original user. <var>Unix-group</var> is one of:</p> 250 251 <dl> 252 <dt>A group name</dt> 253 <dd>Refers to the given group by name.</dd> 254 255 <dt><code>#</code> followed by a group number.</dt> 256 <dd>Refers to a group by its number.</dd> 257 </dl> 258 259 <div class="example"><h3>Example</h3><p><code> 260 Group www-group 261 </code></p></div> 262 263 <p>It is recommended that you set up a new group specifically for 264 running the server. Some admins use user <code>nobody</code>, 265 but this is not always possible or desirable.</p> 266 267 <div class="warning"><h3>Security</h3> 268 <p>Don't set <code class="directive">Group</code> (or <code class="directive"><a href="#user">User</a></code>) to <code>root</code> unless 269 you know exactly what you are doing, and what the dangers are.</p> 270 </div> 271 272 <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 273 configure your server for <code class="program"><a href="../programs/suexec.html">suexec</a></code> use 274 <code class="directive"><a href="../mod/mod_suexec.html#suexecusergroup">SuexecUserGroup</a></code>.</p> 275 276 <div class="note"><h3>Note</h3> 277 <p>Although the <code class="directive">Group</code> directive is present 278 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, 279 it is actually a no-op there and only exists for compatibility 280 reasons.</p> 281 </div> 282 283 </div> 284 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> 285 <div class="directive-section"><h2><a name="Listen" id="Listen">Listen</a> <a name="listen" id="listen">Directive</a></h2> 286 <table class="directive"> 287 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>IP addresses and ports that the server 288 listens to</td></tr> 289 <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> 290 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr> 291 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr> 292 <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> 293 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Required directive since Apache 2.0<br /> 294 The <var>protocol</var> argument was added in 2.1.5</td></tr> 295 </table> 296 <p>The <code class="directive">Listen</code> directive instructs Apache to 297 listen to only specific IP addresses or ports; by default it 298 responds to requests on all IP interfaces. <code class="directive">Listen</code> 299 is now a required directive. If it is not in the config file, the 300 server will fail to start. This is a change from previous versions 301 of Apache.</p> 302 303 <p>The <code class="directive">Listen</code> directive tells the server to 304 accept incoming requests on the specified port or address-and-port 305 combination. If only a port number is specified, the server listens to 306 the given port on all interfaces. If an IP address is given as well 307 as a port, the server will listen on the given port and 308 interface.</p> 309 310 <p>Multiple <code class="directive">Listen</code> directives may be used to 311 specify a number of addresses and ports to listen to. The server will 312 respond to requests from any of the listed addresses and ports.</p> 313 314 <p>For example, to make the server accept connections on both 315 port 80 and port 8000, use:</p> 316 317 <div class="example"><p><code> 318 Listen 80<br /> 319 Listen 8000 320 </code></p></div> 321 322 <p>To make the server accept connections on two specified 323 interfaces and port numbers, use </p> 324 325 <div class="example"><p><code> 326 Listen 192.170.2.1:80<br /> 327 Listen 192.170.2.5:8000 328 </code></p></div> 329 330 <p>IPv6 addresses must be surrounded in square brackets, as in the 331 following example:</p> 332 333 <div class="example"><p><code> 334 Listen [2001:db8::a00:20ff:fea7:ccea]:80 335 </code></p></div> 336 337 <p>The optional <var>protocol</var> argument is not required for most 338 configurations. If not specified, <code>https</code> is the default for 339 port 443 and <code>http</code> the default for all other ports. The 340 protocol is used to determine which module should handle a request, and 341 to apply protocol specific optimizations with the 342 <code class="directive"><a href="../mod/core.html#acceptfilter">AcceptFilter</a></code> directive.</p> 343 344 <p>You only need to set the protocol if you are running on non-standard 345 ports. For example, running an <code>https</code> site on port 8443:</p> 346 347 <div class="example"><p><code> 348 Listen 192.170.2.1:8443 https 349 </code></p></div> 350 351 <div class="note"><h3>Error condition</h3> 352 Multiple <code class="directive">Listen</code> directives for the same ip 353 address and port will result in an <code>Address already in use</code> 354 error message. 355 </div> 356 357 358 <h3>See also</h3> 359 <ul> 360 <li><a href="../dns-caveats.html">DNS Issues</a></li> 361 <li><a href="../bind.html">Setting which addresses and ports Apache 362 uses</a></li> 363 </ul> 364 </div> 365 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> 366 <div class="directive-section"><h2><a name="ListenBackLog" id="ListenBackLog">ListenBackLog</a> <a name="listenbacklog" id="listenbacklog">Directive</a></h2> 367 <table class="directive"> 368 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maximum length of the queue of pending connections</td></tr> 369 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ListenBacklog <var>backlog</var></code></td></tr> 370 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ListenBacklog 511</code></td></tr> 371 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr> 372 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr> 373 <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> 374 </table> 375 <p>The maximum length of the queue of pending connections. 376 Generally no tuning is needed or desired, however on some 377 systems it is desirable to increase this when under a TCP SYN 378 flood attack. See the backlog parameter to the 379 <code>listen(2)</code> system call.</p> 380 381 <p>This will often be limited to a smaller number by the 382 operating system. This varies from OS to OS. Also note that 383 many OSes do not use exactly what is specified as the backlog, 384 but use a number based on (but normally larger than) what is 385 set.</p> 386 387 </div> 388 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> 389 <div class="directive-section"><h2><a name="LockFile" id="LockFile">LockFile</a> <a name="lockfile" id="lockfile">Directive</a></h2> 390 <table class="directive"> 391 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Location of the accept serialization lock file</td></tr> 392 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LockFile <var>filename</var></code></td></tr> 393 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LockFile logs/accept.lock</code></td></tr> 394 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr> 395 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr> 396 <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> 397 </table> 398 <p>The <code class="directive">LockFile</code> directive sets the path to 399 the lockfile used when Apache is used with an <code class="directive"><a href="#acceptmutex">AcceptMutex</a></code> value of either 400 <code>fcntl</code> or <code>flock</code>. This directive should 401 normally be left at its default value. The main reason for changing 402 it is if the <code>logs</code> directory is NFS mounted, since 403 <strong>the lockfile must be stored on a local disk</strong>. The PID 404 of the main server process is automatically appended to the 405 filename.</p> 406 407 <div class="warning"><h3>Security</h3> 408 <p>It is best to <em>avoid</em> putting this file in a world writable 409 directory such as <code>/var/tmp</code> because someone could create 410 a denial of service attack and prevent the server from starting by 411 creating a lockfile with the same name as the one the server will try 412 to create.</p> 413 </div> 414 415 <h3>See also</h3> 416 <ul> 417 <li><code class="directive"><a href="#acceptmutex">AcceptMutex</a></code></li> 418 </ul> 419 </div> 420 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> 421 <div class="directive-section"><h2><a name="MaxClients" id="MaxClients">MaxClients</a> <a name="maxclients" id="maxclients">Directive</a></h2> 422 <table class="directive"> 423 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maximum number of connections that will be processed 424 simultaneously</td></tr> 425 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MaxClients <var>number</var></code></td></tr> 426 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr> 427 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr> 428 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr> 429 <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> 430 </table> 431 <p>The <code class="directive">MaxClients</code> directive sets the limit 432 on the number of simultaneous requests that will be served. Any 433 connection attempts over the <code class="directive">MaxClients</code> 434 limit will normally be queued, up to a number based on the 435 <code class="directive"><a href="#listenbacklog">ListenBacklog</a></code> 436 directive. Once a child process is freed at the end of a different 437 request, the connection will then be serviced.</p> 438 439 <p>For non-threaded servers (<em>i.e.</em>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>), 440 <code class="directive">MaxClients</code> translates into the maximum 441 number of child processes that will be launched to serve requests. 442 The default value is <code>256</code>; to increase it, you must also raise 443 <code class="directive"><a href="#serverlimit">ServerLimit</a></code>.</p> 444 445 <p>For threaded and hybrid servers (<em>e.g.</em> <code class="module"><a href="../mod/beos.html">beos</a></code> 446 or <code class="module"><a href="../mod/worker.html">worker</a></code>) <code class="directive">MaxClients</code> restricts 447 the total number of threads that will be available to serve clients. 448 The default value for <code class="module"><a href="../mod/beos.html">beos</a></code> is <code>50</code>. For 449 hybrid MPMs the default value is <code>16</code> (<code class="directive"><a href="#serverlimit">ServerLimit</a></code>) multiplied by the value of 450 <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, 451 you must also raise <code class="directive"><a href="#serverlimit">ServerLimit</a></code>.</p> 452 453 </div> 454 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> 455 <div class="directive-section"><h2><a name="MaxMemFree" id="MaxMemFree">MaxMemFree</a> <a name="maxmemfree" id="maxmemfree">Directive</a></h2> 456 <table class="directive"> 457 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maximum amount of memory that the main allocator is allowed 458 to hold without calling <code>free()</code></td></tr> 459 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MaxMemFree <var>KBytes</var></code></td></tr> 460 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MaxMemFree 0</code></td></tr> 461 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr> 462 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr> 463 <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> 464 </table> 465 <p>The <code class="directive">MaxMemFree</code> directive sets the 466 maximum number of free Kbytes that the main allocator is allowed 467 to hold without calling <code>free()</code>. When not set, or when set 468 to zero, the threshold will be set to unlimited.</p> 469 470 </div> 471 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> 472 <div class="directive-section"><h2><a name="MaxRequestsPerChild" id="MaxRequestsPerChild">MaxRequestsPerChild</a> <a name="maxrequestsperchild" id="maxrequestsperchild">Directive</a></h2> 473 <table class="directive"> 474 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limit on the number of requests that an individual child server 475 will handle during its life</td></tr> 476 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MaxRequestsPerChild <var>number</var></code></td></tr> 477 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MaxRequestsPerChild 10000</code></td></tr> 478 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr> 479 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr> 480 <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> 481 </table> 482 <p>The <code class="directive">MaxRequestsPerChild</code> directive sets 483 the limit on the number of requests that an individual child 484 server process will handle. After 485 <code class="directive">MaxRequestsPerChild</code> requests, the child 486 process will die. If <code class="directive">MaxRequestsPerChild</code> is 487 <code>0</code>, then the process will never expire.</p> 488 489 <div class="note"><h3>Different default values</h3> 490 <p>The default value for <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code> and 491 <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code> is <code>0</code>.</p> 492 </div> 493 494 <p>Setting <code class="directive">MaxRequestsPerChild</code> to a 495 non-zero value limits the amount of memory that process can consume 496 by (accidental) memory leakage.</p> 497 498 <div class="note"><h3>Note</h3> 499 <p>For <code class="directive"><a href="../mod/core.html#keepalive">KeepAlive</a></code> requests, only 500 the first request is counted towards this limit. In effect, it 501 changes the behavior to limit the number of <em>connections</em> per 502 child.</p> 503 </div> 504 <div class="note"><h3>Default Configuration</h3> 505 <p>The default (compiled-in) value of this setting (10000) is used when 506 no <code class="directive">MaxRequestsPerChild</code> directive is present in the 507 configuration. Many default configurations provided with the server include 508 "MaxRequestsPerChild 0" as part of the <em>default configuration</em>.</p> 509 </div> 510 511 512 </div> 513 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> 514 <div class="directive-section"><h2><a name="MaxSpareThreads" id="MaxSpareThreads">MaxSpareThreads</a> <a name="maxsparethreads" id="maxsparethreads">Directive</a></h2> 515 <table class="directive"> 516 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maximum number of idle threads</td></tr> 517 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MaxSpareThreads <var>number</var></code></td></tr> 518 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr> 519 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr> 520 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr> 521 <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> 522 </table> 523 <p>Maximum number of idle threads. Different MPMs deal with this 524 directive differently.</p> 525 526 <p>For <code class="module"><a href="../mod/worker.html">worker</a></code>, 527 the default is <code>MaxSpareThreads 250</code>. 528 These MPMs deal with idle threads on a server-wide basis. If there 529 are too many idle threads in the server then child processes are 530 killed until the number of idle threads is less than this number.</p> 531 532 <p>For <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code> the default is 533 <code>MaxSpareThreads 100</code>. Since this MPM runs a 534 single-process, the spare thread count is also server-wide.</p> 535 536 <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 537 similar to <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>. The default for 538 <code class="module"><a href="../mod/beos.html">beos</a></code> is <code>MaxSpareThreads 50</code>. For 539 <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code> the default value is <code>10</code>.</p> 540 541 <div class="note"><h3>Restrictions</h3> 542 <p>The range of the <code class="directive">MaxSpareThreads</code> value 543 is restricted. Apache will correct the given value automatically 544 according to the following rules:</p> 545 <ul> 546 547 <li><code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code> wants the value to be greater than 548 <code class="directive"><a href="#minsparethreads">MinSpareThreads</a></code>.</li> 549 550 <li>For 551 <code class="module"><a href="../mod/worker.html">worker</a></code> the value must be greater or equal than 552 the sum of <code class="directive"><a href="#minsparethreads">MinSpareThreads</a></code> 553 and <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code>.</li> 554 </ul> 555 </div> 556 557 <h3>See also</h3> 558 <ul> 559 <li><code class="directive"><a href="#minsparethreads">MinSpareThreads</a></code></li> 560 <li><code class="directive"><a href="#startservers">StartServers</a></code></li> 561 </ul> 562 </div> 563 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> 564 <div class="directive-section"><h2><a name="MinSpareThreads" id="MinSpareThreads">MinSpareThreads</a> <a name="minsparethreads" id="minsparethreads">Directive</a></h2> 565 <table class="directive"> 566 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Minimum number of idle threads available to handle request 567 spikes</td></tr> 568 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MinSpareThreads <var>number</var></code></td></tr> 569 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr> 570 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr> 571 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr> 572 <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> 573 </table> 574 <p>Minimum number of idle threads to handle request spikes. 575 Different MPMs deal with this directive 576 differently.</p> 577 578 579 <p><code class="module"><a href="../mod/worker.html">worker</a></code> 580 uses a default of <code>MinSpareThreads 581 75</code> and deal with idle threads on a server-wide basis. If 582 there aren't enough idle threads in the server then child 583 processes are created until the number of idle threads is greater 584 than number.</p> 585 586 <p><code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code> uses a default of 587 <code>MinSpareThreads 10</code> and, since it is a single-process 588 MPM, tracks this on a server-wide bases.</p> 589 590 <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 591 similar to <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>. The default for 592 <code class="module"><a href="../mod/beos.html">beos</a></code> is <code>MinSpareThreads 1</code>. For 593 <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code> the default value is <code>5</code>.</p> 594 595 <h3>See also</h3> 596 <ul> 597 <li><code class="directive"><a href="#maxsparethreads">MaxSpareThreads</a></code></li> 598 <li><code class="directive"><a href="#startservers">StartServers</a></code></li> 599 </ul> 600 </div> 601 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> 602 <div class="directive-section"><h2><a name="PidFile" id="PidFile">PidFile</a> <a name="pidfile" id="pidfile">Directive</a></h2> 603 <table class="directive"> 604 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>File where the server records the process ID 605 of the daemon</td></tr> 606 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>PidFile <var>filename</var></code></td></tr> 607 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>PidFile logs/httpd.pid</code></td></tr> 608 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr> 609 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr> 610 <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> 611 </table> 612 <p>The <code class="directive">PidFile</code> directive sets the file to 613 which the server records the process id of the daemon. If the 614 filename is not absolute then it is assumed to be relative to the 615 <code class="directive"><a href="../mod/core.html#serverroot">ServerRoot</a></code>.</p> 616 617 <div class="example"><h3>Example</h3><p><code> 618 PidFile /var/run/apache.pid 619 </code></p></div> 620 621 <p>It is often useful to be able to send the server a signal, 622 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 623 re-reads its configuration files. This is done by sending a 624 SIGHUP (kill -1) signal to the process id listed in the 625 <code class="directive">PidFile</code>.</p> 626 627 <p>The <code class="directive">PidFile</code> is subject to the same 628 warnings about log file placement and <a href="../misc/security_tips.html#serverroot">security</a>.</p> 629 630 <div class="note"><h3>Note</h3> 631 <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> 632 </div> 633 634 </div> 635 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> 636 <div class="directive-section"><h2><a name="ReceiveBufferSize" id="ReceiveBufferSize">ReceiveBufferSize</a> <a name="receivebuffersize" id="receivebuffersize">Directive</a></h2> 637 <table class="directive"> 638 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>TCP receive buffer size</td></tr> 639 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ReceiveBufferSize <var>bytes</var></code></td></tr> 640 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ReceiveBufferSize 0</code></td></tr> 641 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr> 642 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr> 643 <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> 644 </table> 645 <p>The server will set the TCP receive buffer size to the number of 646 bytes specified.</p> 647 648 <p>If set to the value of <code>0</code>, the server will use the 649 OS default.</p> 650 651 </div> 652 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> 653 <div class="directive-section"><h2><a name="ScoreBoardFile" id="ScoreBoardFile">ScoreBoardFile</a> <a name="scoreboardfile" id="scoreboardfile">Directive</a></h2> 654 <table class="directive"> 655 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Location of the file used to store coordination data for 656 the child processes</td></tr> 657 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ScoreBoardFile <var>file-path</var></code></td></tr> 658 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ScoreBoardFile logs/apache_runtime_status</code></td></tr> 659 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr> 660 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr> 661 <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> 662 </table> 663 <p>Apache uses a scoreboard to communicate between its parent 664 and child processes. Some architectures require a file to facilitate 665 this communication. If the file is left unspecified, Apache first 666 attempts to create the scoreboard entirely in memory (using anonymous 667 shared memory) and, failing that, will attempt to create the file on 668 disk (using file-based shared memory). Specifying this directive causes 669 Apache to always create the file on the disk.</p> 670 671 <div class="example"><h3>Example</h3><p><code> 672 ScoreBoardFile /var/run/apache_runtime_status 673 </code></p></div> 674 675 <p>File-based shared memory is useful for third-party applications 676 that require direct access to the scoreboard.</p> 677 678 <p>If you use a <code class="directive">ScoreBoardFile</code> then 679 you may see improved speed by placing it on a RAM disk. But be 680 careful that you heed the same warnings about log file placement 681 and <a href="../misc/security_tips.html">security</a>.</p> 682 683 <h3>See also</h3> 684 <ul> 685 <li><a href="../stopping.html">Stopping and Restarting 686 Apache</a></li> 687 </ul> 688 </div> 689 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> 690 <div class="directive-section"><h2><a name="SendBufferSize" id="SendBufferSize">SendBufferSize</a> <a name="sendbuffersize" id="sendbuffersize">Directive</a></h2> 691 <table class="directive"> 692 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>TCP buffer size</td></tr> 693 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SendBufferSize <var>bytes</var></code></td></tr> 694 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>SendBufferSize 0</code></td></tr> 695 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr> 696 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr> 697 <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> 698 </table> 699 <p>The server will set the TCP send buffer size to the number of bytes 700 specified. Very useful to increase past standard OS defaults on 701 high speed high latency (<em>i.e.</em>, 100ms or so, such as 702 transcontinental fast pipes).</p> 703 704 <p>If set to the value of <code>0</code>, the server will use the 705 OS default.</p> 706 707 <p>Further configuration of your operating system may be required to elicit 708 better performance on high speed, high latency connections.</p> 709 710 <div class="note"> <p> On some operating systems, changes in TCP behavior resulting 711 from a larger <code class="directive">SendBufferSize</code> may not be seen unless 712 <code class="directive"><a href="../mod/core.html#enablesendfile">EnableSendfile</a></code> is set to OFF. This 713 interaction applies only to static files.</p> </div> 714 715 716 </div> 717 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> 718 <div class="directive-section"><h2><a name="ServerLimit" id="ServerLimit">ServerLimit</a> <a name="serverlimit" id="serverlimit">Directive</a></h2> 719 <table class="directive"> 720 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Upper limit on configurable number of processes</td></tr> 721 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerLimit <var>number</var></code></td></tr> 722 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr> 723 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr> 724 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr> 725 <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> 726 </table> 727 <p>For the <code class="module"><a href="../mod/prefork.html">prefork</a></code> MPM, this directive sets the 728 maximum configured value for <code class="directive"><a href="#maxclients">MaxClients</a></code> for the lifetime of the 729 Apache process. For the <code class="module"><a href="../mod/worker.html">worker</a></code> MPM, this directive 730 in combination with <code class="directive"><a href="#threadlimit">ThreadLimit</a></code> sets 731 the maximum configured value for <code class="directive"><a href="#maxclients">MaxClients</a></code> for the lifetime of the 732 Apache process. Any attempts to change this directive during a 733 restart will be ignored, but <code class="directive"><a href="#maxclients">MaxClients</a></code> can be modified during 734 a restart.</p> 735 736 <p>Special care must be taken when using this directive. If 737 <code class="directive">ServerLimit</code> is set to a value much higher 738 than necessary, extra, unused shared memory will be allocated. If 739 both <code class="directive">ServerLimit</code> and <code class="directive"><a href="#maxclients">MaxClients</a></code> are set to values 740 higher than the system can handle, Apache may not start or the 741 system may become unstable.</p> 742 743 <p>With the <code class="module"><a href="../mod/prefork.html">prefork</a></code> MPM, use this directive only 744 if you need to set <code class="directive"><a href="#maxclients">MaxClients</a></code> higher than 256 (default). 745 Do not set the value of this directive any higher than what you 746 might want to set <code class="directive"><a href="#maxclients">MaxClients</a></code> to.</p> 747 748 <p>With <code class="module"><a href="../mod/worker.html">worker</a></code> 749 use this directive only 750 if your <code class="directive"><a href="#maxclients">MaxClients</a></code> and 751 <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code> 752 settings require more than 16 server processes (default). Do not set 753 the value of this directive any higher than the number of server 754 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> 755 756 <div class="note"><h3>Note</h3> 757 <p>There is a hard limit of <code>ServerLimit 20000</code> compiled 758 into the server (for the <code class="module"><a href="../mod/prefork.html">prefork</a></code> MPM 200000). This is 759 intended to avoid nasty effects caused by typos.</p> 760 </div> 761 762 <h3>See also</h3> 763 <ul> 764 <li><a href="../stopping.html">Stopping and Restarting Apache</a></li> 765 </ul> 766 </div> 767 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> 768 <div class="directive-section"><h2><a name="StartServers" id="StartServers">StartServers</a> <a name="startservers" id="startservers">Directive</a></h2> 769 <table class="directive"> 770 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Number of child server processes created at startup</td></tr> 771 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>StartServers <var>number</var></code></td></tr> 772 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr> 773 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr> 774 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr> 775 <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> 776 </table> 777 <p>The <code class="directive">StartServers</code> directive sets the 778 number of child server processes created on startup. As the number 779 of processes is dynamically controlled depending on the load, 780 there is usually little reason to adjust this parameter.</p> 781 782 <p>The default value differs from MPM to MPM. For 783 <code class="module"><a href="../mod/worker.html">worker</a></code> the default is <code>StartServers 3</code>. 784 For <code class="module"><a href="../mod/prefork.html">prefork</a></code> defaults to <code>5</code> and for 785 <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code> to <code>2</code>.</p> 786 787 </div> 788 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> 789 <div class="directive-section"><h2><a name="StartThreads" id="StartThreads">StartThreads</a> <a name="startthreads" id="startthreads">Directive</a></h2> 790 <table class="directive"> 791 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Number of threads created on startup</td></tr> 792 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>StartThreads <var>number</var></code></td></tr> 793 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr> 794 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr> 795 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr> 796 <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> 797 </table> 798 <p>Number of threads created on startup. As the 799 number of threads is dynamically controlled depending on the 800 load, there is usually little reason to adjust this 801 parameter.</p> 802 803 <p>For <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code> the default is 804 <code>StartThreads 50</code> and, since there is only a single 805 process, this is the total number of threads created at startup to 806 serve requests.</p> 807 808 <p>For <code class="module"><a href="../mod/beos.html">beos</a></code> the default is <code>StartThreads 809 10</code>. It also reflects the total number of threads created 810 at startup to serve requests.</p> 811 812 </div> 813 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> 814 <div class="directive-section"><h2><a name="ThreadLimit" id="ThreadLimit">ThreadLimit</a> <a name="threadlimit" id="threadlimit">Directive</a></h2> 815 <table class="directive"> 816 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets the upper limit on the configurable number of threads 817 per child process</td></tr> 818 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ThreadLimit <var>number</var></code></td></tr> 819 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr> 820 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr> 821 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr> 822 <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> 823 <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 824 and later</td></tr> 825 </table> 826 <p>This directive sets the maximum configured value for <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code> for the lifetime 827 of the Apache process. Any attempts to change this directive 828 during a restart will be ignored, but <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code> can be modified 829 during a restart up to the value of this directive.</p> 830 831 <p>Special care must be taken when using this directive. If 832 <code class="directive">ThreadLimit</code> is set to a value much higher 833 than <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code>, 834 extra unused shared memory will be allocated. If both 835 <code class="directive">ThreadLimit</code> and <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code> are set to values 836 higher than the system can handle, Apache may not start or the 837 system may become unstable. Do not set the value of this directive 838 any higher than your greatest predicted setting of <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code> for the 839 current run of Apache.</p> 840 841 <p>The default value for <code class="directive">ThreadLimit</code> is 842 <code>1920</code> when used with <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code> and 843 <code>64</code> when used with the others.</p> 844 845 <div class="note"><h3>Note</h3> 846 <p>There is a hard limit of <code>ThreadLimit 20000</code> (or 847 <code>ThreadLimit 15000</code> with <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>) 848 compiled into the server. This is intended to avoid nasty effects 849 caused by typos.</p> 850 </div> 851 852 </div> 853 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> 854 <div class="directive-section"><h2><a name="ThreadsPerChild" id="ThreadsPerChild">ThreadsPerChild</a> <a name="threadsperchild" id="threadsperchild">Directive</a></h2> 855 <table class="directive"> 856 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Number of threads created by each child process</td></tr> 857 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ThreadsPerChild <var>number</var></code></td></tr> 858 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr> 859 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr> 860 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr> 861 <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> 862 </table> 863 <p>This directive sets the number of threads created by each 864 child process. The child creates these threads at startup and 865 never creates more. If using an MPM like <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>, 866 where there is only one child process, this number should be high 867 enough to handle the entire load of the server. If using an MPM 868 like <code class="module"><a href="../mod/worker.html">worker</a></code>, where there are multiple child processes, 869 the <em>total</em> number of threads should be high enough to handle 870 the common load on the server.</p> 871 872 <p>The default value for <code class="directive">ThreadsPerChild</code> is 873 <code>64</code> when used with <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code> and 874 <code>25</code> when used with the others.</p> 875 876 </div> 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="ThreadStackSize" id="ThreadStackSize">ThreadStackSize</a> <a name="threadstacksize" id="threadstacksize">Directive</a></h2> 879 <table class="directive"> 880 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>The size in bytes of the stack used by threads handling 881 client connections</td></tr> 882 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ThreadStackSize <var>size</var></code></td></tr> 883 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>65536 on NetWare; varies on other operating systems</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/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>, <code class="module"><a href="../mod/event.html">event</a></code></td></tr> 887 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.1 and later</td></tr> 888 </table> 889 <p>The <code class="directive">ThreadStackSize</code> directive sets the 890 size of the stack (for autodata) of threads which handle client 891 connections and call modules to help process those connections. 892 In most cases the operating system default for stack size is 893 reasonable, but there are some conditions where it may need to be 894 adjusted:</p> 895 896 <ul> 897 <li>On platforms with a relatively small default thread stack size 898 (e.g., HP-UX), Apache may crash when using some third-party modules 899 which use a relatively large amount of autodata storage. Those 900 same modules may have worked fine on other platforms where the 901 default thread stack size is larger. This type of crash is 902 resolved by setting <code class="directive">ThreadStackSize</code> to a 903 value higher than the operating system default. This type of 904 adjustment is necessary only if the provider of the third-party 905 module specifies that it is required, or if diagnosis of an Apache 906 crash indicates that the thread stack size was too small.</li> 907 908 <li>On platforms where the default thread stack size is 909 significantly larger than necessary for the web server 910 configuration, a higher number of threads per child process 911 will be achievable if <code class="directive">ThreadStackSize</code> is 912 set to a value lower than the operating system default. This type 913 of adjustment should only be made in a test environment which allows 914 the full set of web server processing can be exercised, as there 915 may be infrequent requests which require more stack to process. 916 The minimum required stack size strongly depends on the modules 917 used, but any change in the web server configuration can invalidate 918 the current <code class="directive">ThreadStackSize</code> setting.</li> 919 </ul> 920 921 <div class="note">It is recommended to not reduce <code class="directive">ThreadStackSize</code> 922 unless a high number of threads per child process is needed. On some 923 platforms (including Linux), a setting of 128000 is already too low and 924 causes crashes with some common modules.</div> 925 926 </div> 927 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> 928 <div class="directive-section"><h2><a name="User" id="User">User</a> <a name="user" id="user">Directive</a></h2> 929 <table class="directive"> 930 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>The userid under which the server will answer 931 requests</td></tr> 932 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>User <var>unix-userid</var></code></td></tr> 933 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>User #-1</code></td></tr> 934 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr> 935 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr> 936 <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> 937 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Only valid in global server config since Apache 938 2.0</td></tr> 939 </table> 940 <p>The <code class="directive">User</code> directive sets the user ID as 941 which the server will answer requests. In order to use this 942 directive, the server must be run initially as <code>root</code>. 943 If you start the server as a non-root user, it will fail to change 944 to the lesser privileged user, and will instead continue to run as 945 that original user. If you do start the server as <code>root</code>, 946 then it is normal for the parent process to remain running as root. 947 <var>Unix-userid</var> is one of:</p> 948 949 <dl> 950 <dt>A username</dt> 951 <dd>Refers to the given user by name.</dd> 952 953 <dt># followed by a user number.</dt> 954 <dd>Refers to a user by its number.</dd> 955 </dl> 956 957 <p>The user should have no privileges that result in it being 958 able to access files that are not intended to be visible to the 959 outside world, and similarly, the user should not be able to 960 execute code that is not meant for HTTP requests. It is 961 recommended that you set up a new user and group specifically for 962 running the server. Some admins use user <code>nobody</code>, but 963 this is not always desirable, since the <code>nobody</code> user 964 can have other uses on the system.</p> 965 966 <div class="warning"><h3>Security</h3> 967 <p>Don't set <code class="directive">User</code> (or <code class="directive"><a href="#group">Group</a></code>) to <code>root</code> unless 968 you know exactly what you are doing, and what the dangers are.</p> 969 </div> 970 971 <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 972 configure your server for <code class="program"><a href="../programs/suexec.html">suexec</a></code> use 973 <code class="directive"><a href="../mod/mod_suexec.html#suexecusergroup">SuexecUserGroup</a></code>.</p> 974 975 <div class="note"><h3>Note</h3> 976 <p>Although the <code class="directive">User</code> directive is present 977 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, 978 it is actually a no-op there and only exists for compatibility 979 reasons.</p> 980 </div> 981 982 </div> 983 </div> 984 <div class="bottomlang"> 985 <p><span>Available Languages: </span><a href="../de/mod/mpm_common.html" hreflang="de" rel="alternate" title="Deutsch"> de </a> | 986 <a href="../en/mod/mpm_common.html" title="English"> en </a> | 987 <a href="../ja/mod/mpm_common.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> | 988 <a href="../tr/mod/mpm_common.html" hreflang="tr" rel="alternate" title="Türkçe"> tr </a></p> 989 </div><div class="top"><a href="#page-header"><img src="../images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div> 990 <script type="text/javascript"><!--//--><![CDATA[//><!-- 991 var comments_shortname = 'httpd'; 992 var comments_identifier = 'http://httpd.apache.org/docs/2.2/mod/mpm_common.html'; 993 (function(w, d) { 994 if (w.location.hostname.toLowerCase() == "httpd.apache.org") { 995 d.write('<div id="comments_thread"><\/div>'); 996 var s = d.createElement('script'); 997 s.type = 'text/javascript'; 998 s.async = true; 999 s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier; 1000 (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s); 1001 } 1002 else { 1003 d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>'); 1004 } 1005 })(window, document); 1006 //--><!]]></script></div><div id="footer"> 1007 <p class="apache">Copyright 2017 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> 1008 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!-- 1009 if (typeof(prettyPrint) !== 'undefined') { 1010 prettyPrint(); 1011 } 1012 //--><!]]></script> 1013 </body></html>