mpm_common.xml revision 87ffb6e33f3cbef3b9bb406cc2d27039fa336eaa
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<!DOCTYPE modulesynopsis SYSTEM "/style/modulesynopsis.dtd">
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<?xml-stylesheet type="text/xsl" href="/style/manual.en.xsl"?>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen Copyright 2002-2004 The Apache Software Foundation
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen Licensed under the Apache License, Version 2.0 (the "License");
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen you may not use this file except in compliance with the License.
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen You may obtain a copy of the License at
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen Unless required by applicable law or agreed to in writing, software
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen distributed under the License is distributed on an "AS IS" BASIS,
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen See the License for the specific language governing permissions and
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen limitations under the License.
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<modulesynopsis metafile="mpm_common.xml.meta">
2d49f150b4bce6f2f59a84e268e4777901c3e42cTimo Sirainen<description>A collection of directives that are implemented by
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainenmore than one multi-processing module (MPM)</description>
2e99f3f3bb35715ce5e0a75a2f2a9bac3ab4224bTimo Sirainen<directivesynopsis>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<description>Method that Apache uses to serialize multiple children
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainenaccepting requests on network sockets</description>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<syntax>AcceptMutex Default|<var>method</var></syntax>
2e99f3f3bb35715ce5e0a75a2f2a9bac3ab4224bTimo Sirainen<contextlist><context>server config</context></contextlist>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<modulelist><module>leader</module><module>perchild</module>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<module>prefork</module><module>threadpool</module><module>worker</module>
eddd9bf1a1369aea4a2715f6be1137da6d17d293Timo Sirainen <p>The <directive>AcceptMutex</directive> directives sets the
eddd9bf1a1369aea4a2715f6be1137da6d17d293Timo Sirainen method that Apache uses to serialize multiple children accepting
19e8adccba16ff419f5675b1575358c2956dce83Timo Sirainen requests on network sockets. Prior to Apache 2.0, the method was
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen selectable only at compile time. The optimal method to use is
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen highly architecture and platform dependent. For further details,
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen see the <a href="/misc/perf-tuning.html">performance tuning</a>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen documentation.</p>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen <p>If this directive is set to <code>Default</code>, then the
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen compile-time selected default will be used. Other possible
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen methods are listed below. Note that not all methods are
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen available on all platforms. If a method is specified which is
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen not available, a message will be written to the error log
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen listing the available methods.</p>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen <dd>uses the <code>flock(2)</code> system call to lock the
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen file defined by the <directive module="mpm_common"
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen <dd>uses the <code>fcntl(2)</code> system call to lock the
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen file defined by the <directive module="mpm_common"
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen <dd>uses POSIX compatible semaphores to implement the mutex.</dd>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen <dd>uses POSIX mutexes as implemented by the POSIX Threads
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen (PThreads) specification.</dd>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen <dd>uses SySV-style semaphores to implement the mutex.</dd>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen <p>If you want to find out the compile time chosen default
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen for your system, you may set your <directive module="core"
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen >LogLevel</directive> to <code>debug</code>. Then the default <directive
0f66f12eb4cdbf47670975044c88d8f388bf92dfTimo Sirainen >AcceptMutex</directive> will be written into the <directive
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen <p>On most systems, when the <code>pthread</code> option
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen is selected, if a child process terminates abnormally
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen while holding the <code>AcceptCntl</code> mutex the
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen server will stop responding to requests. When this
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen occurs, the server will require a manual restart to
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen <p>Solaris is a notable exception as it provides a
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen mechanism, used by Apache, which usually allows the
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen mutex to be recovered after a child process terminates
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen abnormally while holding a mutex.</p>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen <p>If your system implements the
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen <code>pthread_mutexattr_setrobust_np()</code> function,
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen you may be able to use the <code>pthread</code> option safely.</p>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen</directivesynopsis>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<directivesynopsis>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<description>Directory where Apache attempts to
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainenswitch before dumping core</description>
85144b5f0bc763de14c7d87291a90ef74ac241a2Timo Sirainen<syntax>CoreDumpDirectory <var>directory</var></syntax>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<default>See usage for the default setting</default>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<contextlist><context>server config</context></contextlist>
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen<modulelist><module>beos</module><module>leader</module>
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen<module>mpm_winnt</module><module>perchild</module><module>prefork</module>
85144b5f0bc763de14c7d87291a90ef74ac241a2Timo Sirainen<module>threadpool</module><module>worker</module></modulelist>
85144b5f0bc763de14c7d87291a90ef74ac241a2Timo Sirainen <p>This controls the directory to which Apache attempts to
85144b5f0bc763de14c7d87291a90ef74ac241a2Timo Sirainen switch before dumping core. The default is in the
85144b5f0bc763de14c7d87291a90ef74ac241a2Timo Sirainen <directive module="core">ServerRoot</directive> directory, however
85144b5f0bc763de14c7d87291a90ef74ac241a2Timo Sirainen since this should not be writable by the user the server runs
85144b5f0bc763de14c7d87291a90ef74ac241a2Timo Sirainen as, core dumps won't normally get written. If you want a core
85144b5f0bc763de14c7d87291a90ef74ac241a2Timo Sirainen dump for debugging, you can use this directive to place it in a
85144b5f0bc763de14c7d87291a90ef74ac241a2Timo Sirainen different location.</p>
85144b5f0bc763de14c7d87291a90ef74ac241a2Timo Sirainen <p>If Apache starts as root and switches to another user, the
85144b5f0bc763de14c7d87291a90ef74ac241a2Timo Sirainen Linux kernel <em>disables</em> core dumps even if the directory is
85144b5f0bc763de14c7d87291a90ef74ac241a2Timo Sirainen writable for the process. Apache (2.0.46 and later) reenables core dumps
85144b5f0bc763de14c7d87291a90ef74ac241a2Timo Sirainen on Linux 2.4 and beyond, but only if you explicitly configure a <directive
85144b5f0bc763de14c7d87291a90ef74ac241a2Timo Sirainen</directivesynopsis>
85144b5f0bc763de14c7d87291a90ef74ac241a2Timo Sirainen<directivesynopsis>
0bf3eac1110a902e7ec7e695c64e8e46c114e623Timo Sirainen<description>Enables a hook that runs exception handlers
85144b5f0bc763de14c7d87291a90ef74ac241a2Timo Sirainenafter a crash</description>
85144b5f0bc763de14c7d87291a90ef74ac241a2Timo Sirainen<contextlist><context>server config</context></contextlist>
85144b5f0bc763de14c7d87291a90ef74ac241a2Timo Sirainen<modulelist><module>leader</module><module>perchild</module>
85144b5f0bc763de14c7d87291a90ef74ac241a2Timo Sirainen<module>prefork</module><module>threadpool</module>
85144b5f0bc763de14c7d87291a90ef74ac241a2Timo Sirainen<compatibility>Available in version 2.0.49 an later</compatibility>
85144b5f0bc763de14c7d87291a90ef74ac241a2Timo Sirainen <p>For safety reasons this directive is only available if the server was
85144b5f0bc763de14c7d87291a90ef74ac241a2Timo Sirainen configured with the <code>--enable-exception-hook</code> option. It
85144b5f0bc763de14c7d87291a90ef74ac241a2Timo Sirainen enables a hook that allows external modules to plug in and do something
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen after a child crashed.</p>
85144b5f0bc763de14c7d87291a90ef74ac241a2Timo Sirainen <p>There are already two modules, <code>mod_whatkilledus</code> and
85144b5f0bc763de14c7d87291a90ef74ac241a2Timo Sirainen <code>mod_backtrace</code> that make use of this hook. Please have a
85144b5f0bc763de14c7d87291a90ef74ac241a2Timo Sirainen look at Jeff Trawick's <a
85144b5f0bc763de14c7d87291a90ef74ac241a2Timo Sirainen href="http://www.apache.org/~trawick/exception_hook.html"
85144b5f0bc763de14c7d87291a90ef74ac241a2Timo Sirainen >EnableExceptionHook site</a> for more information about these.</p>
85144b5f0bc763de14c7d87291a90ef74ac241a2Timo Sirainen</directivesynopsis>
85144b5f0bc763de14c7d87291a90ef74ac241a2Timo Sirainen<directivesynopsis>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<description>Group under which the server will answer
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainenrequests</description>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<contextlist><context>server config</context></contextlist>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<modulelist><module>beos</module><module>leader</module>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<module>mpmt_os2</module><module>perchild</module><module>prefork</module>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<module>threadpool</module><module>worker</module></modulelist>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<compatibility>Only valid in global server config since Apache
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen2.0</compatibility>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen <p>The <directive>Group</directive> directive sets the group under
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen which the server will answer requests. In order to use this
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen directive, the server must be run initially as <code>root</code>. If
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen you start the server as a non-root user, it will fail to change to the
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen specified group, and will instead continue to run as the group of the
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen original user. <var>Unix-group</var> is one of:</p>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen <dt><code>#</code> followed by a group number.</dt>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen Group www-group
14c474d9f4591c397ed0b5206af6537c7b52c924Timo Sirainen <p>It is recommended that you set up a new group specifically for
14c474d9f4591c397ed0b5206af6537c7b52c924Timo Sirainen running the server. Some admins use user <code>nobody</code>,
2d49f150b4bce6f2f59a84e268e4777901c3e42cTimo Sirainen but this is not always possible or desirable.</p>
2d49f150b4bce6f2f59a84e268e4777901c3e42cTimo Sirainen <p>Don't set <directive>Group</directive> (or <directive
2d49f150b4bce6f2f59a84e268e4777901c3e42cTimo Sirainen module="mpm_common">User</directive>) to <code>root</code> unless
2d49f150b4bce6f2f59a84e268e4777901c3e42cTimo Sirainen you know exactly what you are doing, and what the dangers are.</p>
8d131435ba4648c8821160ec38d508c97177c715Timo Sirainen <p>Special note: Use of this directive in <directive module="core"
8d131435ba4648c8821160ec38d508c97177c715Timo Sirainen type="section">VirtualHost</directive> is no longer supported. To
8d131435ba4648c8821160ec38d508c97177c715Timo Sirainen configure your server for <a href="mod_suexec.html">suexec</a> use
b6612c334604eeb27e1ca2bd804ac66dcbc2eaadTimo Sirainen <directive module="mod_suexec">SuexecUserGroup</directive>.</p>
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen <p>Although the <directive>Group</directive> directive is present
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen in the <module>beos</module> and <module>mpmt_os2</module> MPMs,
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen it is actually a no-op there and only exists for compatibility
e64d7b6f388fecd0c83a4f2acb54e30d5ac98c6cTimo Sirainen</directivesynopsis>
e64d7b6f388fecd0c83a4f2acb54e30d5ac98c6cTimo Sirainen<directivesynopsis>
e64d7b6f388fecd0c83a4f2acb54e30d5ac98c6cTimo Sirainen<description>File where the server records the process ID
e64d7b6f388fecd0c83a4f2acb54e30d5ac98c6cTimo Sirainenof the daemon</description>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<contextlist><context>server config</context></contextlist>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<modulelist><module>beos</module><module>leader</module>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<module>mpm_winnt</module><module>mpmt_os2</module>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<module>perchild</module><module>prefork</module>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<module>threadpool</module><module>worker</module></modulelist>
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen <p>The <directive>PidFile</directive> directive sets the file to
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen which the server records the process id of the daemon. If the
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen filename is not absolute then it is assumed to be relative to the
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen <directive module="core">ServerRoot</directive>.</p>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen <p>It is often useful to be able to send the server a signal,
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen so that it closes and then re-opens its <directive
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen module="core">ErrorLog</directive> and <directive
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen module="mod_log_config">TransferLog</directive>, and
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen re-reads its configuration files. This is done by sending a
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen SIGHUP (kill -1) signal to the process id listed in the
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen <p>The <directive>PidFile</directive> is subject to the same
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen warnings about log file placement and <a
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen href="/misc/security_tips.html#serverroot">security</a>.</p>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen <p>As of Apache 2 it is recommended to use only the <a
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen href="/programs/apachectl.html">apachectl</a> script for
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen (re-)starting or stopping the server.</p>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen</directivesynopsis>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<directivesynopsis>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<description>IP addresses and ports that the server
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainenlistens to</description>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<syntax>Listen [<var>IP-address</var>:]<var>portnumber</var></syntax>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<contextlist><context>server config</context></contextlist>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<modulelist><module>beos</module><module>leader</module>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<module>mpm_netware</module><module>mpm_winnt</module>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<module>mpmt_os2</module><module>perchild</module>
5707510e5d1c8aa79a0acf737ee1429caf3d59c2Timo Sirainen<module>prefork</module><module>threadpool</module><module>worker</module>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<compatibility>Required directive since Apache 2.0</compatibility>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen <p>The <directive>Listen</directive> directive instructs Apache to
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen listen to only specific IP addresses or ports; by default it
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen responds to requests on all IP interfaces. <directive>Listen</directive>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen is now a required directive. If it is not in the config file, the
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen server will fail to start. This is a change from previous versions
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen of Apache.</p>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen <p>The <directive>Listen</directive> directive tells the server to
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen accept incoming requests on the specified port or address-and-port
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen combination. If only a port number is specified, the server listens to
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen the given port on all interfaces. If an IP address is given as well
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen as a port, the server will listen on the given port and
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen interface.</p>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen <p>Multiple <directive>Listen</directive> directives may be used to
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen specify a number of addresses and ports to listen to. The server will
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen respond to requests from any of the listed addresses and ports.</p>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen <p>For example, to make the server accept connections on both
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen port 80 and port 8000, use:</p>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen Listen 80<br />
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen <p>To make the server accept connections on two specified
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen interfaces and port numbers, use </p>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen Listen 192.170.2.1:80<br />
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen Listen 192.170.2.5:8000
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen <p>IPv6 addresses must be surrounded in square brackets, as in the
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen following example:</p>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen Listen [fe80::a00:20ff:fea7:ccea]:80
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<seealso><a href="/dns-caveats.html">DNS Issues</a></seealso>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<seealso><a href="/bind.html">Setting which addresses and ports Apache
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen</directivesynopsis>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<directivesynopsis>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<description>Maximum length of the queue of pending connections</description>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<syntax>ListenBacklog <var>backlog</var></syntax>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<contextlist><context>server config</context></contextlist>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<modulelist><module>beos</module><module>leader</module>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<module>mpm_netware</module><module>mpm_winnt</module>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<module>mpmt_os2</module><module>perchild</module><module>prefork</module>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<module>threadpool</module><module>worker</module></modulelist>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen <p>The maximum length of the queue of pending connections.
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen Generally no tuning is needed or desired, however on some
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen systems it is desirable to increase this when under a TCP SYN
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen flood attack. See the backlog parameter to the
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen <p>This will often be limited to a smaller number by the
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen operating system. This varies from OS to OS. Also note that
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen many OSes do not use exactly what is specified as the backlog,
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen but use a number based on (but normally larger than) what is
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen</directivesynopsis>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<directivesynopsis>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<description>Location of the accept serialization lock file</description>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<contextlist><context>server config</context></contextlist>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<modulelist><module>leader</module><module>perchild</module>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<module>prefork</module><module>threadpool</module><module>worker</module>
aef92409cf369afdd2ecd81a4f80083cd4082f46Timo Sirainen <p>The <directive>LockFile</directive> directive sets the path to
aef92409cf369afdd2ecd81a4f80083cd4082f46Timo Sirainen the lockfile used when Apache is used with an <directive
aef92409cf369afdd2ecd81a4f80083cd4082f46Timo Sirainen module="mpm_common">AcceptMutex</directive> value of either
aef92409cf369afdd2ecd81a4f80083cd4082f46Timo Sirainen <code>fcntl</code> or <code>flock</code>. This directive should
aef92409cf369afdd2ecd81a4f80083cd4082f46Timo Sirainen normally be left at its default value. The main reason for changing
aef92409cf369afdd2ecd81a4f80083cd4082f46Timo Sirainen it is if the <code>logs</code> directory is NFS mounted, since
aef92409cf369afdd2ecd81a4f80083cd4082f46Timo Sirainen <strong>the lockfile must be stored on a local disk</strong>. The PID
aef92409cf369afdd2ecd81a4f80083cd4082f46Timo Sirainen of the main server process is automatically appended to the
aef92409cf369afdd2ecd81a4f80083cd4082f46Timo Sirainen filename.</p>
aef92409cf369afdd2ecd81a4f80083cd4082f46Timo Sirainen <p>It is best to <em>avoid</em> putting this file in a world writable
aef92409cf369afdd2ecd81a4f80083cd4082f46Timo Sirainen directory such as <code>/var/tmp</code> because someone could create
aef92409cf369afdd2ecd81a4f80083cd4082f46Timo Sirainen a denial of service attack and prevent the server from starting by
aef92409cf369afdd2ecd81a4f80083cd4082f46Timo Sirainen creating a lockfile with the same name as the one the server will try
aef92409cf369afdd2ecd81a4f80083cd4082f46Timo Sirainen to create.</p>
aef92409cf369afdd2ecd81a4f80083cd4082f46Timo Sirainen<seealso><directive module="mpm_common">AcceptMutex</directive></seealso>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen</directivesynopsis>
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen<directivesynopsis>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<description>Maximum number of child processes that will be created
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainento serve requests</description>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<contextlist><context>server config</context></contextlist>
2d49f150b4bce6f2f59a84e268e4777901c3e42cTimo Sirainen<modulelist><module>beos</module><module>leader</module>
2d49f150b4bce6f2f59a84e268e4777901c3e42cTimo Sirainen<module>prefork</module><module>threadpool</module><module>worker</module>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen <p>The <directive>MaxClients</directive> directive sets the limit
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen on the number of simultaneous requests that will be served. Any
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen connection attempts over the <directive>MaxClients</directive>
aef92409cf369afdd2ecd81a4f80083cd4082f46Timo Sirainen limit will normally be queued, up to a number based on the
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen <directive module="mpm_common">ListenBacklog</directive>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen directive. Once a child process is freed at the end of a different
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen request, the connection will then be serviced.</p>
aef92409cf369afdd2ecd81a4f80083cd4082f46Timo Sirainen <p>For non-threaded servers (<em>i.e.</em>, <module>prefork</module>),
aef92409cf369afdd2ecd81a4f80083cd4082f46Timo Sirainen <directive>MaxClients</directive> translates into the maximum
aef92409cf369afdd2ecd81a4f80083cd4082f46Timo Sirainen number of child processes that will be launched to serve requests.
aef92409cf369afdd2ecd81a4f80083cd4082f46Timo Sirainen The default value is <code>256</code>; to increase it, you must also raise
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen <directive module="mpm_common">ServerLimit</directive>.</p>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen <p>For threaded and hybrid servers (<em>e.g.</em> <module>beos</module>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen or <module>worker</module>) <directive>MaxClients</directive> restricts
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen the total number of threads that will be available to serve clients.
aef92409cf369afdd2ecd81a4f80083cd4082f46Timo Sirainen The default value for <module>beos</module> is <code>50</code>. For
aef92409cf369afdd2ecd81a4f80083cd4082f46Timo Sirainen hybrid MPMs the default value is <code>16</code> (<directive
aef92409cf369afdd2ecd81a4f80083cd4082f46Timo Sirainen module="mpm_common">ServerLimit</directive>) multiplied by the value of
aef92409cf369afdd2ecd81a4f80083cd4082f46Timo Sirainen <code>25</code> (<directive module="mpm_common"
aef92409cf369afdd2ecd81a4f80083cd4082f46Timo Sirainen >ThreadsPerChild</directive>). Therefore, to increase <directive
aef92409cf369afdd2ecd81a4f80083cd4082f46Timo Sirainen >MaxClients</directive> to a value that requires more than 16 processes,
aef92409cf369afdd2ecd81a4f80083cd4082f46Timo Sirainen you must also raise <directive module="mpm_common"
aef92409cf369afdd2ecd81a4f80083cd4082f46Timo Sirainen</directivesynopsis>
aef92409cf369afdd2ecd81a4f80083cd4082f46Timo Sirainen<directivesynopsis>
aef92409cf369afdd2ecd81a4f80083cd4082f46Timo Sirainen<description>Maximum amount of memory that the main allocator is allowed
aef92409cf369afdd2ecd81a4f80083cd4082f46Timo Sirainento hold without calling <code>free()</code></description>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<contextlist><context>server config</context></contextlist>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<modulelist><module>beos</module><module>leader</module>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<module>mpm_netware</module><module>prefork</module>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<module>threadpool</module><module>worker</module><module>mpm_winnt</module></modulelist>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen <p>The <directive>MaxMemFree</directive> directive sets the
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen maximum number of free Kbytes that the main allocator is allowed
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen to hold without calling <code>free()</code>. When not set, or when set
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen to zero, the threshold will be set to unlimited.</p>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen</directivesynopsis>
2d49f150b4bce6f2f59a84e268e4777901c3e42cTimo Sirainen<directivesynopsis>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<description>Limit on the number of requests that an individual child server
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainenwill handle during its life</description>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<syntax>MaxRequestsPerChild <var>number</var></syntax>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<contextlist><context>server config</context></contextlist>
94aa90d2d17a7aebcda5a4193a62e80ddbb169b7Timo Sirainen<modulelist><module>leader</module><module>mpm_netware</module>
94aa90d2d17a7aebcda5a4193a62e80ddbb169b7Timo Sirainen<module>mpm_winnt</module><module>mpmt_os2</module>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<module>perchild</module><module>prefork</module>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<module>threadpool</module><module>worker</module></modulelist>
2d49f150b4bce6f2f59a84e268e4777901c3e42cTimo Sirainen <p>The <directive>MaxRequestsPerChild</directive> directive sets
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen the limit on the number of requests that an individual child
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen server process will handle. After
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen <directive>MaxRequestsPerChild</directive> requests, the child
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen process will die. If <directive>MaxRequestsPerChild</directive> is
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen <code>0</code>, then the process will never expire.</p>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen <p>The default value for <module>mpm_netware</module> and
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen <module>mpm_winnt</module> is <code>0</code>.</p>
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen <p>Setting <directive>MaxRequestsPerChild</directive> to a
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen non-zero limit has two beneficial effects:</p>
2e99f3f3bb35715ce5e0a75a2f2a9bac3ab4224bTimo Sirainen <li>it limits the amount of memory that process can consume
2e99f3f3bb35715ce5e0a75a2f2a9bac3ab4224bTimo Sirainen by (accidental) memory leakage;</li>
2e99f3f3bb35715ce5e0a75a2f2a9bac3ab4224bTimo Sirainen <li>by giving processes a finite lifetime, it helps reduce
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen the number of processes when the server load reduces.</li>
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen <p>For <directive module="core">KeepAlive</directive> requests, only
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen the first request is counted towards this limit. In effect, it
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen changes the behavior to limit the number of <em>connections</em> per
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen</directivesynopsis>
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen<directivesynopsis>
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen<description>Maximum number of idle threads</description>
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen<syntax>MaxSpareThreads <var>number</var></syntax>
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen<contextlist><context>server config</context></contextlist>
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen<modulelist><module>beos</module><module>leader</module>
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen<module>mpm_netware</module><module>mpmt_os2</module>
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen<module>perchild</module><module>threadpool</module><module>worker</module>
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen <p>Maximum number of idle threads. Different MPMs deal with this
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen directive differently.</p>
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen <p>For <module>perchild</module> the default is
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen <code>MaxSpareThreads 10</code>. This MPM monitors the number of
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen idle threads on a per-child basis. If there are too many idle
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen threads in that child, the server will begin to kill threads
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen within that child.</p>
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen <p>For <module>worker</module>, <module>leader</module> and <module
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen >threadpool</module> the default is <code>MaxSpareThreads 250</code>.
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen These MPMs deal with idle threads on a server-wide basis. If there
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen are too many idle threads in the server then child processes are
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen killed until the number of idle threads is less than this number.</p>
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen <p>For <module>mpm_netware</module> the default is
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen <code>MaxSpareThreads 100</code>. Since this MPM runs a
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen single-process, the spare thread count is also server-wide.</p>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen <p><module>beos</module> and <module>mpmt_os2</module> work
ae8817f05005f57bba32479a610b52d083e2b6ebTimo Sirainen similar to <module>mpm_netware</module>. The default for
ae8817f05005f57bba32479a610b52d083e2b6ebTimo Sirainen <module>beos</module> is <code>MaxSpareThreads 50</code>. For
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen <module>mpmt_os2</module> the default value is <code>10</code>.</p>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen <p>The range of the <directive>MaxSpareThreads</directive> value
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen is restricted. Apache will correct the given value automatically
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen according to the following rules:</p>
04b8a90af181cc4c7959266855e8ed50a22ed413Timo Sirainen <li><module>perchild</module> requires <directive
04b8a90af181cc4c7959266855e8ed50a22ed413Timo Sirainen >MaxSpareThreads</directive> to be less or equal than <directive
04b8a90af181cc4c7959266855e8ed50a22ed413Timo Sirainen module="mpm_common">ThreadLimit</directive>.</li>
04b8a90af181cc4c7959266855e8ed50a22ed413Timo Sirainen <li><module>mpm_netware</module> wants the value to be greater than
04b8a90af181cc4c7959266855e8ed50a22ed413Timo Sirainen <directive module="mpm_common">MinSpareThreads</directive>.</li>
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen <li>For <module>leader</module>, <module>threadpool</module> and
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen <module>worker</module> the value must be greater or equal than
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen the sum of <directive module="mpm_common">MinSpareThreads</directive>
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen and <directive module="mpm_common">ThreadsPerChild</directive>.</li>
ae8817f05005f57bba32479a610b52d083e2b6ebTimo Sirainen<seealso><directive module="mpm_common">MinSpareThreads</directive></seealso>
ae8817f05005f57bba32479a610b52d083e2b6ebTimo Sirainen<seealso><directive module="mpm_common">StartServers</directive></seealso>
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen</directivesynopsis>
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen<directivesynopsis>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<description>Minimum number of idle threads available to handle request
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainenspikes</description>
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen<syntax>MinSpareThreads <var>number</var></syntax>
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen<contextlist><context>server config</context></contextlist>
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen<modulelist><module>beos</module><module>leader</module>
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen<module>mpm_netware</module><module>mpmt_os2</module>
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen<module>perchild</module><module>threadpool</module><module>worker</module>
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen <p>Minimum number of idle threads to handle request spikes.
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen Different MPMs deal with this directive
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen differently.</p>
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen <p><module>perchild</module> uses a default of
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen <code>MinSpareThreads 5</code> and monitors the number of idle
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen threads on a per-child basis. If there aren't enough idle threads
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen in that child, the server will begin to create new threads within
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen that child. Thus, if you set <directive module="perchild"
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen >NumServers</directive> to <code>10</code> and a <directive
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen >MinSpareThreads</directive> value of <code>5</code>, you'll have
347acd14d8da653ce3757b3e29981326502bed6bTimo Sirainen at least 50 idle threads on your system.</p>
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen <p><module>worker</module>, <module>leader</module> and
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen <module>threadpool</module> use a default of <code>MinSpareThreads
8cd0a1a2200e65cd134d03fe3f93ec02f1746359Timo Sirainen 75</code> and deal with idle threads on a server-wide basis. If
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen there aren't enough idle threads in the server then child
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen processes are created until the number of idle threads is greater
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen than number.</p>
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen <p><module>mpm_netware</module> uses a default of
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen <code>MinSpareThreads 10</code> and, since it is a single-process
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen MPM, tracks this on a server-wide bases.</p>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen <p><module>beos</module> and <module>mpmt_os2</module> work
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen similar to <module>mpm_netware</module>. The default for
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen <module>beos</module> is <code>MinSpareThreads 1</code>. For
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen <module>mpmt_os2</module> the default value is <code>5</code>.</p>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<seealso><directive module="mpm_common">MaxSpareThreads</directive></seealso>
ae8817f05005f57bba32479a610b52d083e2b6ebTimo Sirainen<seealso><directive module="mpm_common">StartServers</directive></seealso>
ae8817f05005f57bba32479a610b52d083e2b6ebTimo Sirainen</directivesynopsis>
85144b5f0bc763de14c7d87291a90ef74ac241a2Timo Sirainen<directivesynopsis>
ae8817f05005f57bba32479a610b52d083e2b6ebTimo Sirainen<description>Location of the file used to store coordination data for
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainenthe child processes</description>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<syntax>ScoreBoardFile <var>file-path</var></syntax>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<default>ScoreBoardFile logs/apache_status</default>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<contextlist><context>server config</context></contextlist>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<modulelist><module>beos</module><module>leader</module>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<module>mpm_winnt</module><module>perchild</module><module>prefork</module>
51b979b6414b940f04677a7e2d064be119345954Timo Sirainen<module>threadpool</module><module>worker</module></modulelist>
51b979b6414b940f04677a7e2d064be119345954Timo Sirainen <p>Apache uses a scoreboard to communicate between its parent
51b979b6414b940f04677a7e2d064be119345954Timo Sirainen and child processes. Some architectures require a file to facilitate
51b979b6414b940f04677a7e2d064be119345954Timo Sirainen this communication. If the file is left unspecified, Apache first
51b979b6414b940f04677a7e2d064be119345954Timo Sirainen attempts to create the scoreboard entirely in memory (using anonymous
51b979b6414b940f04677a7e2d064be119345954Timo Sirainen shared memory) and, failing that, will attempt to create the file on
51b979b6414b940f04677a7e2d064be119345954Timo Sirainen disk (using file-based shared memory). Specifying this directive causes
51b979b6414b940f04677a7e2d064be119345954Timo Sirainen Apache to always create the file on the disk.</p>
629600d9a85e8025c15a5eaeb80329e116e022c9Timo Sirainen <p>File-based shared memory is useful for third-party applications
629600d9a85e8025c15a5eaeb80329e116e022c9Timo Sirainen that require direct access to the scoreboard.</p>
629600d9a85e8025c15a5eaeb80329e116e022c9Timo Sirainen <p>If you use a <directive>ScoreBoardFile</directive> then
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen you may see improved speed by placing it on a RAM disk. But be
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen careful that you heed the same warnings about log file placement
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen and <a href="/misc/security_tips.html">security</a>.</p>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<seealso><a href="/stopping.html">Stopping and Restarting
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen</directivesynopsis>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<directivesynopsis>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<syntax>SendBufferSize <var>bytes</var></syntax>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<contextlist><context>server config</context></contextlist>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<modulelist><module>beos</module><module>leader</module>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<module>mpm_netware</module><module>mpm_winnt</module>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<module>mpmt_os2</module><module>perchild</module><module>prefork</module>
9716b2665ee3938d3dfe64bda44d7c3ae3b55d30Timo Sirainen<module>threadpool</module><module>worker</module></modulelist>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen <p>The server will set the TCP buffer size to the number of bytes
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen specified. Very useful to increase past standard OS defaults on
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen high speed high latency (<em>i.e.</em>, 100ms or so, such as
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen transcontinental fast pipes).</p>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen <p>If set to the value of <code>0</code>, the server will use the
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen OS deault.</p>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen</directivesynopsis>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<directivesynopsis>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<description>Upper limit on configurable number of processes</description>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<contextlist><context>server config</context></contextlist>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<modulelist><module>leader</module><module>perchild</module>
ae8817f05005f57bba32479a610b52d083e2b6ebTimo Sirainen<module>prefork</module><module>threadpool</module><module>worker</module>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen <p>For the <module>prefork</module> MPM, this directive sets the
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen maximum configured value for <directive
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen module="mpm_common">MaxClients</directive> for the lifetime of the
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen Apache process. For the <module>worker</module> MPM, this directive
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen in combination with <directive
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen module="mpm_common">ThreadLimit</directive> sets
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen the maximum configured value for <directive
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen module="mpm_common">MaxClients</directive> for the lifetime of the
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen Apache process. Any attempts to change this directive during a
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen restart will be ignored, but <directive
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen module="mpm_common">MaxClients</directive> can be modified during
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen a restart.</p>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen <p>Special care must be taken when using this directive. If
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen <directive>ServerLimit</directive> is set to a value much higher
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen than necessary, extra, unused shared memory will be allocated. If
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen both <directive>ServerLimit</directive> and <directive
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen module="mpm_common">MaxClients</directive> are set to values
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen higher than the system can handle, Apache may not start or the
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen system may become unstable.</p>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen <p>With the <module>prefork</module> MPM, use this directive only
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen if you need to set <directive
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen module="mpm_common">MaxClients</directive> higher than 256 (default).
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen Do not set the value of this directive any higher than what you
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen might want to set <directive
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen module="mpm_common">MaxClients</directive> to.</p>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen <p>With <module>worker</module>, <module>leader</module> and
ae8817f05005f57bba32479a610b52d083e2b6ebTimo Sirainen <module>threadpool</module> use this directive only
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen if your <directive module="mpm_common">MaxClients</directive> and
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen <directive module="mpm_common">ThreadsPerChild</directive>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen settings require more than 16 server processes (default). Do not set
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen the value of this directive any higher than the number of server
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen processes required by what you may want for <directive
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen module="mpm_common">MaxClients </directive> and <directive
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen module="mpm_common">ThreadsPerChild</directive>.</p>
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen <p>With the <module>perchild</module> MPM, use this directive only
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen if you need to set <directive
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen module="perchild">NumServers</directive> higher than 8 (default).</p>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen <p>There is a hard limit of <code>ServerLimit 20000</code> compiled
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen into the server (for the <module>prefork</module> MPM 200000). This is
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen intended to avoid nasty effects caused by typos.</p>
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen<seealso><a href="/stopping.html">Stopping and Restarting Apache</a></seealso>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen</directivesynopsis>
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen<directivesynopsis>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<description>Number of child server processes created at startup</description>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<syntax>StartServers <var>number</var></syntax>
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen<contextlist><context>server config</context></contextlist>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen<modulelist><module>leader</module><module>mpmt_os2</module>
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen<module>prefork</module><module>threadpool</module><module>worker</module>
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen <p>The <directive>StartServers</directive> directive sets the
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen number of child server processes created on startup. As the number
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen of processes is dynamically controlled depending on the load,
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen there is usually little reason to adjust this parameter.</p>
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen <p>The default value differs from MPM to MPM. For
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen <module>leader</module>, <module>threadpool</module> and
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen <module>worker</module> the default is <code>StartServers 3</code>.
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen For <module>prefork</module> defaults to <code>5</code> and for
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen <module>mpmt_os2</module> to <code>2</code>.</p>
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen</directivesynopsis>
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen<directivesynopsis>
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen<description>Number of threads created on startup</description>
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen<syntax>StartThreads <var>number</var></syntax>
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen<contextlist><context>server config</context></contextlist>
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen<modulelist><module>beos</module><module>mpm_netware</module>
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen <p>Number of threads created on startup. As the
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen number of threads is dynamically controlled depending on the
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen load, there is usually little reason to adjust this
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen parameter.</p>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen <p>For <module>perchild</module> the default is <code>StartThreads
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen 5</code> and this directive tracks the number of threads per
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen process at startup.</p>
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen <p>For <module>mpm_netware</module> the default is
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen <code>StartThreads 50</code> and, since there is only a single
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen process, this is the total number of threads created at startup to
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen serve requests.</p>
51795bfe9d05d92fe942cb451aec2b9d16d32a11Timo Sirainen <p>For <module>beos</module> the default is <code>StartThreads
51795bfe9d05d92fe942cb451aec2b9d16d32a11Timo Sirainen 10</code>. It also reflects the total number of threads created
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen at startup to serve requests.</p>
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen</directivesynopsis>
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen<directivesynopsis>
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen<description>Sets the upper limit on the configurable number of threads
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainenper child process</description>
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen<contextlist><context>server config</context></contextlist>
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen<modulelist><module>leader</module><module>mpm_winnt</module>
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen<module>perchild</module><module>threadpool</module><module>worker</module>
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen<compatibility>Available for <module>mpm_winnt</module> in Apache 2.0.41
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainenand later</compatibility>
f87702d8d147f66d3fb6c41e5695c67f6d00612eTimo Sirainen <p>This directive sets the maximum configured value for <directive
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen module="mpm_common">ThreadsPerChild</directive> for the lifetime
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen of the Apache process. Any attempts to change this directive
51795bfe9d05d92fe942cb451aec2b9d16d32a11Timo Sirainen during a restart will be ignored, but <directive
51795bfe9d05d92fe942cb451aec2b9d16d32a11Timo Sirainen module="mpm_common">ThreadsPerChild</directive> can be modified
51795bfe9d05d92fe942cb451aec2b9d16d32a11Timo Sirainen during a restart up to the value of this directive.</p>
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen <p>Special care must be taken when using this directive. If
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen <directive>ThreadLimit</directive> is set to a value much higher
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen than <directive module="mpm_common">ThreadsPerChild</directive>,
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen extra unused shared memory will be allocated. If both
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen <directive>ThreadLimit</directive> and <directive
85144b5f0bc763de14c7d87291a90ef74ac241a2Timo Sirainen module="mpm_common">ThreadsPerChild</directive> are set to values
85144b5f0bc763de14c7d87291a90ef74ac241a2Timo Sirainen higher than the system can handle, Apache may not start or the
85144b5f0bc763de14c7d87291a90ef74ac241a2Timo Sirainen system may become unstable. Do not set the value of this directive
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen any higher than your greatest predicted setting of <directive
85144b5f0bc763de14c7d87291a90ef74ac241a2Timo Sirainen module="mpm_common">ThreadsPerChild</directive> for the
85144b5f0bc763de14c7d87291a90ef74ac241a2Timo Sirainen current run of Apache.</p>
85144b5f0bc763de14c7d87291a90ef74ac241a2Timo Sirainen <p>The default value for <directive>ThreadLimit</directive> is
85144b5f0bc763de14c7d87291a90ef74ac241a2Timo Sirainen <code>1920</code> when used with <module>mpm_winnt</module> and
85144b5f0bc763de14c7d87291a90ef74ac241a2Timo Sirainen <code>64</code> when used with the others.</p>
85144b5f0bc763de14c7d87291a90ef74ac241a2Timo Sirainen <p>There is a hard limit of <code>ThreadLimit 20000</code> (or
85144b5f0bc763de14c7d87291a90ef74ac241a2Timo Sirainen <code>ThreadLimit 15000</code> with <module>mpm_winnt</module>)
85144b5f0bc763de14c7d87291a90ef74ac241a2Timo Sirainen compiled into the server. This is intended to avoid nasty effects
85144b5f0bc763de14c7d87291a90ef74ac241a2Timo Sirainen caused by typos.</p>
85144b5f0bc763de14c7d87291a90ef74ac241a2Timo Sirainen</directivesynopsis>
85144b5f0bc763de14c7d87291a90ef74ac241a2Timo Sirainen<directivesynopsis>
85144b5f0bc763de14c7d87291a90ef74ac241a2Timo Sirainen<description>Number of threads created by each child process</description>
85144b5f0bc763de14c7d87291a90ef74ac241a2Timo Sirainen<syntax>ThreadsPerChild <var>number</var></syntax>
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen<contextlist><context>server config</context></contextlist>
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen<modulelist><module>leader</module><module>mpm_winnt</module>
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen<module>threadpool</module><module>worker</module></modulelist>
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen <p>This directive sets the number of threads created by each
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen child process. The child creates these threads at startup and
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen never creates more. If using an MPM like <module>mpm_winnt</module>,
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen where there is only one child process, this number should be high
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen enough to handle the entire load of the server. If using an MPM
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen like <module>worker</module>, where there are multiple child processes,
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen the <em>total</em> number of threads should be high enough to handle
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen the common load on the server.</p>
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen <p>The default value for <directive>ThreadsPerChild</directive> is
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen <code>64</code> when used with <module>mpm_winnt</module> and
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen <code>25</code> when used with the others.</p>
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen</directivesynopsis>
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen<directivesynopsis>
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen<description>The size in bytes of the stack used by threads handling
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainenclient connections</description>
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen<syntax>ThreadStackSize <var>size</var></syntax>
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen<default>65536 on NetWare; varies on other operating systems</default>
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen<contextlist><context>server config</context></contextlist>
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen<modulelist><module>leader</module><module>mpm_netware</module>
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen<module>mpm_winnt</module><module>perchild</module>
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen<module>threadpool</module><module>worker</module>
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen<compatibility>Available in Apache 2.1 and later</compatibility>
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen <p>The <directive>ThreadStackSize</directive> directive sets the
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen size of the stack (for autodata) of threads which handle client
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen connections and call modules to help process those connections.
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen In most cases the operating system default for stack size is
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen reasonable, but there are some conditions where it may need to be
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen adjusted:</p>
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen <li>On platforms with a relatively small default thread stack size
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen (e.g., HP-UX), Apache may crash when using some third-party modules
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen which use a relatively large amount of autodata storage. Those
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen same modules may have worked fine on other platforms where the
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen default thread stack size is larger. This type of crash is
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen resolved by setting <directive>ThreadStackSize</directive> to a
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen value higher than the operating system default. This type of
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen adjustment is necessary only if the provider of the third-party
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen module specifies that it is required, or if diagnosis of an Apache
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen crash indicates that the thread stack size was too small.</li>
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen <li>On platforms where the default thread stack size is
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen significantly larger than necessary for the web server
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen configuration, a higher number of threads per child process
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen will be achievable if <directive>ThreadStackSize</directive> is
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen set to a value lower than the operating system default. This type
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen of adjustment should only be made in a test environment which allows
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen the full set of web server processing can be exercised, as there
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen may be infrequent requests which require more stack to process.
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen A change in the web server configuration can invalidate the
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen current <directive>ThreadStackSize</directive> setting.</li>
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen</directivesynopsis>
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen<directivesynopsis>
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen<description>The userid under which the server will answer
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainenrequests</description>
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen<contextlist><context>server config</context></contextlist>
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen<modulelist><module>leader</module><module>perchild</module>
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen<module>prefork</module><module>threadpool</module><module>worker</module>
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen<compatibility>Only valid in global server config since Apache
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen2.0</compatibility>
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen <p>The <directive>User</directive> directive sets the user ID as
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen which the server will answer requests. In order to use this
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen directive, the server must be run initially as <code>root</code>.
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen If you start the server as a non-root user, it will fail to change
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen to the lesser privileged user, and will instead continue to run as
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen that original user. If you do start the server as <code>root</code>,
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen then it is normal for the parent process to remain running as root.
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen <p>The user should have no privileges that result in it being
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen able to access files that are not intended to be visible to the
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen outside world, and similarly, the user should not be able to
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen execute code that is not meant for HTTP requests. It is
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen recommended that you set up a new user and group specifically for
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen running the server. Some admins use user <code>nobody</code>, but
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen this is not always desirable, since the <code>nobody</code> user
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen can have other uses on the system.</p>
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen <p>Don't set <directive>User</directive> (or <directive
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen module="mpm_common">Group</directive>) to <code>root</code> unless
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen you know exactly what you are doing, and what the dangers are.</p>
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen <p>With the <module>perchild</module> MPM, which is intended to
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen server virtual hosts run under different user IDs, the
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen <directive>User</directive> directive defines the user ID for the
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen main server and the fallback for <directive type="section"
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen module="core">VirtualHost</directive> sections without an
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen <directive module="perchild">AssignUserID</directive> directive.</p>
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen <p>Special note: Use of this directive in <directive module="core"
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen type="section">VirtualHost</directive> is no longer supported. To
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen configure your server for <a href="/suexec.html">suexec</a> use
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen <directive module="mod_suexec">SuexecUserGroup</directive>.</p>
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen <p>Although the <directive>User</directive> directive is present
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen in the <module>beos</module> and <module>mpmt_os2</module> MPMs,
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen it is actually a no-op there and only exists for compatibility
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen</directivesynopsis>
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen</modulesynopsis>