[APACHE DOCUMENTATION]

Apache HTTP Server

  • el
  • pt
  • Server-Wide Configuration

    This document explains some of the directives provided by the core server which are used to configure the basic operations of the server.


    Server Identification

    Related Directives

    ServerName
    ServerAdmin
    ServerSignature
    ServerTokens
    UseCanonicalName

    The ServerAdmin and ServerTokens directives control what information about the server will be presented in server-generated documents such as error messages. The ServerTokens directive sets the value of the Server HTTP response header field.

    The ServerName and UseCanonicalName directives are used by the server to determine how to construct self-referential URLs. For example, when a client requests a directory, but does not include the trailing slash in the directory name, Apache must redirect the client to the full name including the trailing slash so that the client will correctly resolve relative references in the document.


    File Locations

    Related Directives

    CoreDumpDirectory
    DocumentRoot
    ErrorLog
    Lockfile
    PidFile
    ScoreBoardFile
    ServerRoot

    These directives control the locations of the various files that Apache needs for proper operation. When the pathname used does not begin with a slash "/", the files are located relative to the ServerRoot. Be careful about locating files in paths which are writable by non-root users. See the security tips documentation for more details.


    Process Creation

    Related Directives

    BS2000Account
    Group
    MaxClients
    MaxRequestsPerChild
    MaxSpareServers
    MinSpareServers
    ServerType
    StartServers
    ThreadsPerChild
    User

    When ServerType is set to its recommended value of Standalone, Apache 1.3 for Unix is a pre-forking web server. A single control process is responsible for launching child processes which listen for connections and serve them when they arrive. Apache always tries to maintain several spare or idle server processes, which stand ready to serve incoming requests. In this way, clients do not need to wait for a new child processes to be forked before their requests can be served.

    The StartServers, MinSpareServers, MaxSpareServers, and MaxServers regulate how the parent process creates children to serve requests. In general, Apache is very self-regulating, so most sites do not need to adjust these directives from their default values. Sites which need to serve more than 256 simultaneous requests may need to increase MaxClients, while sites with limited memory may need to decrease MaxClients to keep the server from thrashing (swapping memory to disk and back). More information about tuning process creation is provided in the performance hints documentation.

    While the parent process is usually started as root under Unix in order to bind to port 80, the child processes are launched by Apache as a less-privileged user. The User and Group directives are used to set the privileges of the Apache child processes. The child processes must be able to read all the content that will be served, but should have as few privileges beyond that as possible. In addition, unless suexec is used, these directives also set the privileges which will be inherited by CGI scripts.

    MaxRequestsPerChild controls how frequently the server recycles processes by killing old ones and launching new ones.

    Under Windows, Apache launches one control process and one child process. The child process creates multiple threads to serve requests. The number of threads is controlled by the ThreadsPerChild directive.


    Network Configuration

    Related Directives

    BindAddress
    KeepAlive
    KeepAliveTimeout
    Listen
    ListenBackLog
    AcceptFilter
    AcceptMutex
    MaxKeepAliveRequests
    Port
    SendBufferSize
    TimeOut

    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 Port 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 Virtual Host feature which determines how Apache responds to different IP addresses, hostnames and ports.

    There are two directives used to restrict or specify which addresses and ports Apache listens to. The BindAddress directive is used to restrict the server to listening to a single IP address. The Listen directive can be used to specify multiple IP addresses and/or Ports to which Apache will listen.

    The ListenBackLog, SendBufferSize, and TimeOut directives are used to adjust how Apache interacts with the network.AcceptFilter controls a BSD specific filter optimization. See the BSD section on performance hints documentation. AcceptMutex controls which accept mutex method will be used. For an explanation of what this is and why it's needed, see the performance tuning guide

    The KeepAlive, KeepAliveTimeout, and MaxKeepAliveRequests directives are used to configure how Apache handles persistent connections.


    Limiting Resource Usage

    Related Directives

    LimitRequestBody
    LimitRequestFields
    LimitRequestFieldsize
    LimitRequestLine
    RLimitCPU
    RLimitMEM
    RLimitNPROC
    ThreadStackSize

    The LimitRequest* 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.

    The RLimit* 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.

    The ThreadStackSize directive is used only on Netware to control the stack size.


    Apache HTTP Server

    Index