server-wide.html.en revision 06446ae476296b502b18ac1c1cb20959e613af68
a546d8ff17af2eb98179377f39a02ac81459f0bend<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
a546d8ff17af2eb98179377f39a02ac81459f0bend<HTML>
a546d8ff17af2eb98179377f39a02ac81459f0bend<HEAD>
a546d8ff17af2eb98179377f39a02ac81459f0bend<TITLE>Server-Wide Configuration</TITLE>
a546d8ff17af2eb98179377f39a02ac81459f0bend</HEAD>
a546d8ff17af2eb98179377f39a02ac81459f0bend
a546d8ff17af2eb98179377f39a02ac81459f0bend<!-- Background white, links blue (unvisited), navy (visited), red (active) -->
a546d8ff17af2eb98179377f39a02ac81459f0bend<BODY
a546d8ff17af2eb98179377f39a02ac81459f0bend BGCOLOR="#FFFFFF"
a546d8ff17af2eb98179377f39a02ac81459f0bend TEXT="#000000"
a546d8ff17af2eb98179377f39a02ac81459f0bend LINK="#0000FF"
a546d8ff17af2eb98179377f39a02ac81459f0bend VLINK="#000080"
a546d8ff17af2eb98179377f39a02ac81459f0bend ALINK="#FF0000"
a546d8ff17af2eb98179377f39a02ac81459f0bend>
a546d8ff17af2eb98179377f39a02ac81459f0bend<!--#include virtual="header.html" -->
a546d8ff17af2eb98179377f39a02ac81459f0bend<h1 align="center">Server-Wide Configuration</h1>
a546d8ff17af2eb98179377f39a02ac81459f0bend
a546d8ff17af2eb98179377f39a02ac81459f0bend<p>This document explains some of the directives provided by
a546d8ff17af2eb98179377f39a02ac81459f0bend<a href="mod/core.html">core</A> server which are used to configure
a546d8ff17af2eb98179377f39a02ac81459f0bendthe basic operations of the server.</p>
a546d8ff17af2eb98179377f39a02ac81459f0bend
a546d8ff17af2eb98179377f39a02ac81459f0bend<ul>
a546d8ff17af2eb98179377f39a02ac81459f0bend<li><a href="#identification">Server Identification</a></li>
a546d8ff17af2eb98179377f39a02ac81459f0bend<li><a href="#locations">File Locations</a></li>
a546d8ff17af2eb98179377f39a02ac81459f0bend<li><a href="#process">Process Creation</a></li>
a546d8ff17af2eb98179377f39a02ac81459f0bend<li><a href="#network">Network Configuration</a></li>
a546d8ff17af2eb98179377f39a02ac81459f0bend<li><a href="#resource">Limiting Resource Usage</a></li>
a546d8ff17af2eb98179377f39a02ac81459f0bend</ul>
a546d8ff17af2eb98179377f39a02ac81459f0bend
a546d8ff17af2eb98179377f39a02ac81459f0bend<hr>
a546d8ff17af2eb98179377f39a02ac81459f0bend
a546d8ff17af2eb98179377f39a02ac81459f0bend<h2><a name="identfication">Server Identification</a></h2>
a546d8ff17af2eb98179377f39a02ac81459f0bend
a546d8ff17af2eb98179377f39a02ac81459f0bend<table border="1">
a546d8ff17af2eb98179377f39a02ac81459f0bend<tr><td valign="top">
a546d8ff17af2eb98179377f39a02ac81459f0bend<strong>Related Directives</strong><br><br>
a546d8ff17af2eb98179377f39a02ac81459f0bend
a546d8ff17af2eb98179377f39a02ac81459f0bend<A HREF="mod/core.html#servername">ServerName</A><br>
a546d8ff17af2eb98179377f39a02ac81459f0bend<A HREF="mod/core.html#serveradmin">ServerAdmin</A><br>
a546d8ff17af2eb98179377f39a02ac81459f0bend<A HREF="mod/core.html#serversignature">ServerSignature</A><br>
a546d8ff17af2eb98179377f39a02ac81459f0bend<A HREF="mod/core.html#servertokens">ServerTokens</A><br>
a546d8ff17af2eb98179377f39a02ac81459f0bend<A HREF="mod/core.html#usecanonicalname">UseCanonicalName</A><br>
a546d8ff17af2eb98179377f39a02ac81459f0bend</td></tr></table>
a546d8ff17af2eb98179377f39a02ac81459f0bend
a546d8ff17af2eb98179377f39a02ac81459f0bend<p>The <code>ServerAdmin</code> and <code>ServerTokens</code>
a546d8ff17af2eb98179377f39a02ac81459f0benddirectives control what information about the server will be presented
a546d8ff17af2eb98179377f39a02ac81459f0bendin server-generated documents such as error messages.
184d5ca6f866f95a98dd0b58308df44a966fd874ndThe <code>ServerTokens</code> directive sets the value of the
a546d8ff17af2eb98179377f39a02ac81459f0bendServer HTTP response header field.</p>
a546d8ff17af2eb98179377f39a02ac81459f0bend
184d5ca6f866f95a98dd0b58308df44a966fd874nd<p>The <code>ServerName</code> and <code>UseCanonicalName</code>
a546d8ff17af2eb98179377f39a02ac81459f0benddirectives are used by the server to determine how to construct
a546d8ff17af2eb98179377f39a02ac81459f0bendself-referential URLs. For example, when a client requests a
184d5ca6f866f95a98dd0b58308df44a966fd874nddirectory, but does not include the trailing slash in the directory
a546d8ff17af2eb98179377f39a02ac81459f0bendname, Apache must redirect the client to the full name including the
a546d8ff17af2eb98179377f39a02ac81459f0bendtrailing slash so that the client will correctly resolve relative
a546d8ff17af2eb98179377f39a02ac81459f0bendreferences in the document.</p>
a546d8ff17af2eb98179377f39a02ac81459f0bend
184d5ca6f866f95a98dd0b58308df44a966fd874nd<hr>
a546d8ff17af2eb98179377f39a02ac81459f0bend
a546d8ff17af2eb98179377f39a02ac81459f0bend<h2><a name="locations">File Locations</a></h2>
a546d8ff17af2eb98179377f39a02ac81459f0bend
a546d8ff17af2eb98179377f39a02ac81459f0bend<table border="1">
a546d8ff17af2eb98179377f39a02ac81459f0bend<tr><td valign="top">
a546d8ff17af2eb98179377f39a02ac81459f0bend<strong>Related Directives</strong><br><br>
a546d8ff17af2eb98179377f39a02ac81459f0bend
a546d8ff17af2eb98179377f39a02ac81459f0bend<a href="mod/core.html#coredumpdirectory">CoreDumpDirectory</a><br>
a546d8ff17af2eb98179377f39a02ac81459f0bend<a href="mod/core.html#documentroot">DocumentRoot</a><br>
184d5ca6f866f95a98dd0b58308df44a966fd874nd<a href="mod/core.html#errorlog">ErrorLog</a><br>
184d5ca6f866f95a98dd0b58308df44a966fd874nd<a href="mod/core.html#lockfile">Lockfile</a><br>
a546d8ff17af2eb98179377f39a02ac81459f0bend<a href="mod/core.html#pidfile">PidFile</a><br>
a546d8ff17af2eb98179377f39a02ac81459f0bend<a href="mod/core.html#scoreboardfile">ScoreBoardFile</a><br>
a546d8ff17af2eb98179377f39a02ac81459f0bend<a href="mod/core.html#serverroot">ServerRoot</a><br>
a546d8ff17af2eb98179377f39a02ac81459f0bend</td></tr></table>
a546d8ff17af2eb98179377f39a02ac81459f0bend
a546d8ff17af2eb98179377f39a02ac81459f0bend<p>These directives control the locations of the various files that
a546d8ff17af2eb98179377f39a02ac81459f0bendApache needs for proper operation. When the pathname used does not
184d5ca6f866f95a98dd0b58308df44a966fd874ndbegin with a slash "/", the files are located relative to the
a546d8ff17af2eb98179377f39a02ac81459f0bend<code>ServerRoot</code>. Be careful about locating files in paths
a546d8ff17af2eb98179377f39a02ac81459f0bendwhich are writable by non-root users. See the <a
a546d8ff17af2eb98179377f39a02ac81459f0bendhref="misc/security_tips.html">security tips</a> documentation for
a546d8ff17af2eb98179377f39a02ac81459f0bendmore details.</p>
a546d8ff17af2eb98179377f39a02ac81459f0bend
a546d8ff17af2eb98179377f39a02ac81459f0bend<hr>
a546d8ff17af2eb98179377f39a02ac81459f0bend
a546d8ff17af2eb98179377f39a02ac81459f0bend<h2><a name="process">Process Creation</a></h2>
a546d8ff17af2eb98179377f39a02ac81459f0bend
a546d8ff17af2eb98179377f39a02ac81459f0bend<table border="1">
a546d8ff17af2eb98179377f39a02ac81459f0bend<tr><td valign="top">
a546d8ff17af2eb98179377f39a02ac81459f0bend<strong>Related Directives</strong><br><br>
a546d8ff17af2eb98179377f39a02ac81459f0bend
184d5ca6f866f95a98dd0b58308df44a966fd874nd<a href="mod/core.html#bs2000account">BS2000Account</a><br>
a546d8ff17af2eb98179377f39a02ac81459f0bend<a href="mod/core.html#group">Group</a><br>
a546d8ff17af2eb98179377f39a02ac81459f0bend<a href="mod/core.html#baxclients">MaxClients</a><br>
a546d8ff17af2eb98179377f39a02ac81459f0bend<a href="mod/core.html#maxrequestsperchild">MaxRequestsPerChild</a><br>
a546d8ff17af2eb98179377f39a02ac81459f0bend<a href="mod/core.html#maxspareservers">MaxSpareServers</a><br>
a546d8ff17af2eb98179377f39a02ac81459f0bend<a href="mod/core.html#minspareservers">MinSpareServers</a><br>
a546d8ff17af2eb98179377f39a02ac81459f0bend<a href="mod/core.html#servertype">ServerType</a><br>
a546d8ff17af2eb98179377f39a02ac81459f0bend<a href="mod/core.html#startservers">StartServers</a><br>
a546d8ff17af2eb98179377f39a02ac81459f0bend<a href="mod/core.html#threadsperchild">ThreadsPerChild</a><br>
a546d8ff17af2eb98179377f39a02ac81459f0bend<a href="mod/core.html#user">User</a><br>
a546d8ff17af2eb98179377f39a02ac81459f0bend</td></tr></table>
a546d8ff17af2eb98179377f39a02ac81459f0bend
a546d8ff17af2eb98179377f39a02ac81459f0bend<p>When <code>ServerType</code> is set to its recommended value of
a546d8ff17af2eb98179377f39a02ac81459f0bend<code>Standalone</code>, Apache 1.3 for Unix is a pre-forking web
a546d8ff17af2eb98179377f39a02ac81459f0bendserver. A single control process is responsible for launching child
a546d8ff17af2eb98179377f39a02ac81459f0bendprocesses which listen for connections and serve them when they
a546d8ff17af2eb98179377f39a02ac81459f0bendarrive. Apache always tries to maintain several <em>spare</em> or
a546d8ff17af2eb98179377f39a02ac81459f0bendidle server processes, which stand ready to serve incoming requests.
a546d8ff17af2eb98179377f39a02ac81459f0bendIn this way, clients do not need to wait for a new child processes to
a546d8ff17af2eb98179377f39a02ac81459f0bendbe forked before their requests can be served.</p>
a546d8ff17af2eb98179377f39a02ac81459f0bend
a546d8ff17af2eb98179377f39a02ac81459f0bend<p>The <code>StartServers</code>, <code>MinSpareServers</code>,
a546d8ff17af2eb98179377f39a02ac81459f0bend<code>MaxSpareServers</code>, and <code>MaxServers</code> regulate how
a546d8ff17af2eb98179377f39a02ac81459f0bendthe parent process creates children to serve requests. In general,
184d5ca6f866f95a98dd0b58308df44a966fd874ndApache is very self-regulating, so most sites do not need to adjust
a546d8ff17af2eb98179377f39a02ac81459f0bendthese directives from their default values. Sites which need to serve
a546d8ff17af2eb98179377f39a02ac81459f0bendmore than 256 simultaneous requests may need to increase
a546d8ff17af2eb98179377f39a02ac81459f0bend<code>MaxClients</code>, while sites with limited memory may need to
a546d8ff17af2eb98179377f39a02ac81459f0benddecrease <code>MaxClients</code> to keep the server from thrashing
a546d8ff17af2eb98179377f39a02ac81459f0bend(swapping memory to disk and back).</p>
a546d8ff17af2eb98179377f39a02ac81459f0bend
a546d8ff17af2eb98179377f39a02ac81459f0bend<p>While the parent process is usually started as root under Unix
a546d8ff17af2eb98179377f39a02ac81459f0bendin order to bind to port 80, the child processes are launched
a546d8ff17af2eb98179377f39a02ac81459f0bendby Apache as a less-privileged user. The <code>User</code> and
a546d8ff17af2eb98179377f39a02ac81459f0bend<code>Group</code> directives are used to set the privileges
a546d8ff17af2eb98179377f39a02ac81459f0bendof the Apache child processes. The child processes must
a546d8ff17af2eb98179377f39a02ac81459f0bendbe able to read all the content that will be served, but
a546d8ff17af2eb98179377f39a02ac81459f0bendshould have as few privileges beyond that as possible.
a546d8ff17af2eb98179377f39a02ac81459f0bendIn addition, unless <a href="suexec.html">suexec</a> is used,
a546d8ff17af2eb98179377f39a02ac81459f0bendthese directives also set the privileges which will be inherited
a546d8ff17af2eb98179377f39a02ac81459f0bendby CGI scripts.</p>
a546d8ff17af2eb98179377f39a02ac81459f0bend
a546d8ff17af2eb98179377f39a02ac81459f0bend<p><code>MaxRequestsPerChild</code> controls how frequently the server
184d5ca6f866f95a98dd0b58308df44a966fd874ndrecycles processes by killing old ones and launching new ones.</p>
a546d8ff17af2eb98179377f39a02ac81459f0bend
a546d8ff17af2eb98179377f39a02ac81459f0bend<p>Under Windows, Apache launches one control process and one
184d5ca6f866f95a98dd0b58308df44a966fd874ndchild process. The child process creates multiple threads to
a546d8ff17af2eb98179377f39a02ac81459f0bendserve requests. The number of threads is controlled by the
a546d8ff17af2eb98179377f39a02ac81459f0bend<code>ThreadsPerChild</code> directive.</p>
a546d8ff17af2eb98179377f39a02ac81459f0bend
<hr>
<h2><a name="network">Network Configuration</a></h2>
<table border="1">
<tr><td valign="top">
<strong>Related Directives</strong><br><br>
<a href="mod/core.html#bindaddress">BindAddress</a><br>
<a href="mod/core.html#keepalive">KeepAlive</a><br>
<a href="mod/core.html#keepalivetimeout">KeepAliveTimeout</a><br>
<a href="mod/core.html#listen">Listen</a><br>
<a href="mod/core.html#listenbacklog">ListenBackLog</a><br>
<a href="mod/core.html#maxKeepaliverequests">MaxKeepAliveRequests</a><br>
<a href="mod/core.html#port">Port</a><br>
<a href="mod/core.html#sendbuffersize">SendBufferSize</a><br>
<a href="mod/core.html#timeOut">TimeOut</a><br>
</td></tr></table>
<p>When Apache starts, it connects to some port and address on the
local machine and waits for incoming requests. By default, it listens
to all addresses on the machine, and to the port as specified by the
<code>Port</code> directive in the server configuration. However, it
can be told to listen to more than one port, to listen to only
selected addresses, or a combination. This is often combined with the
<a href="vhosts/">Virtual Host</a> feature which determines how Apache
responds to different IP addresses, hostnames and ports.</p>
<p>There are two directives used to restrict or specify which addresses
and ports Apache listens to. The <code>BindAddress</code> directive
is used to restrict the server to listening to a single IP address.
The <code>Listen</code> directive can be used to specify multiple
IP addresses and/or Ports to which Apache will listen.</p>
<p>The <code>ListenBackLog</code>, <code>SendBufferSize</code>, and
<code>TimeOut</code> directives are used to adjust how Apache
interacts with the network.</p>
<p>The <code>KeepAlive</code>, <code>KeepAliveTimeout</code>,
and <code>MaxKeepAliveRequests</code> directives are used to
configure how Apache handles persistent connections.</p>
<hr>
<h2><a name="resource">Limiting Resource Usage</a></h2>
<table border="1">
<tr><td valign="top">
<strong>Related Directives</strong><br><br>
<a href="mod/core.html#limitrequestbody">LimitRequestBody</a><br>
<a href="mod/core.html#limitrequestfields">LimitRequestFields</a><br>
<a href="mod/core.html#limitrequestfieldsize">LimitRequestFieldsize</a><br>
<a href="mod/core.html#limitrequestline">LimitRequestLine</a><br>
<a href="mod/core.html#rlimitcpu">RLimitCPU</a><br>
<a href="mod/core.html#rlimitmem">RLimitMEM</a><br>
<a href="mod/core.html#rlimitnproc">RLimitNPROC</a><br>
<a href="mod/core.html#threadstacksize">ThreadStackSize</a><br>
</td></tr></table>
<p>The <code>Limit</code>* directives are used to place limits
on the amount of resources Apache will use in reading requests
from clients. By limiting these values, some kinds of denial
of service attacks can be mitigated.</p>
<p>The <code>RLimit</code>* directives are used to limit the amount
of resources which can be used by processes forked off from
the Apache children. In particular, this will control
resources used by CGI scripts and SSI exec commands.</p>
<p>The <code>ThreadStackSize</code> directive is used only
on Netware to control the stock size.</p>
<!--#include virtual="footer.html" -->
</BODY>
</HTML>