Apache is the most widely-used Web server on the Internet. The Apache server was developed from an early version of the NCSA server with the intent of providing further improvement while maintaining compatibility. Apache has now broken ahead as the most popular server, although many sites still use NCSA.
Although this chapter concentrates on documenting Apache, many of the directives listed here are also supported by the NCSA server. For verification of your server's support of a particular directive, we recommend the online documentation. The Apache server and documentation can be obtained from http://www.apache.org. The NCSA server and support information can be obtained from http://hoohoo.ncsa.uiuc.edu.
Apache and NCSA use four separate files to configure their behavior. These are:
Example copies of each of these files are included with the server software distribution.
In addition to the directives themselves, the configuration files may contain any number of blank lines or comment lines beginning with a hash mark (#). Although directive names are not case-sensitive, we use the case conventions in the default files.
The server configuration file, named httpd.conf by default, specifies essential information that the server needs in order to run. This includes what machine and port the server is running on, where log files should be written, and how much of the system's resources the server should claim.
The following sections contain the directives that can be used in the httpd.conf file for the Apache and NCSA servers.
Specifies the location of the access configuration file, either as an absolute path or as a relative path from the ServerRoot directory. For example:
Action mime_type cgi_script
Tells the server to execute the specified CGI script whenever a file of the specified MIME type is requested, sending the requested URL as extra path information.
Specifies the location of the log file that identifies the client program used for each request, either as an absolute path or as a relative path from the server root. For example:
Specifies the name of the server to use for public annotations, as supported by the NCSA Mosaic client. This information will then be sent to clients as the value of the Annotations-cgi MIME header in the response. (NCSA only)
Specifies whether the server should assume MD5 message digest support on the client end.
Specifies the name this server uses when multiple servers are being used for multihoming. Either the IP address or DNS name can be used. For example:
Tells the server to allow remote proxy servers to cache negotiated documents. By default, Apache does not allow caching of negotiated documents.
Specifies the location of the error log file, either an absolute path or relative path to the ServerRoot directory. The default setting is:
Specifies the directory in which core files should be dumped, as an absolute path or a path relative to the ServerRoot directory. By default, these will be dumped into the ServerRoot directory. (NCSA only)
Controls how often and under what circumstances the server will attempt reverse DNS lookup of the client host. Possible values are:
No DNS lookup under any circumstances
DNS lookup only for resolving access permissions
DNS lookup for every request (default)
DNS lookup both to get a name for the address, and to confirm that the name can resolve back to that address
Specifies the group you want the server process to run as. Either a group name or group ID can be specified; a group ID should be preceded by a number sign (#).
Specifies whether the server should attempt to learn the identity of the user for each request by querying the identd process running on the user's machine. By default identity checking is off.
Tells the server to allow persistent connections (default=off). See also KeepAliveTimeOut and MaxKeepAliveRequests.
Specifies the number of seconds to wait for the next request before closing a persistent connection. Used only when persistent connections are enabled with the KeepAlive On setting. The default is 10.
Listen [ IP_address:] port
Tells the server to listen for requests on the specified port for the specified IP address (if supplied). Overrides BindAddress and Port.
Specifies whether the server should be willing to start if any of the log files are in directories that are group writeable. (NCSA only)
Specifies whether the server should be willing to start if any of the log files are in directories that are world writeable. (NCSA only)
Specifies how log information should be written to the various log files. Options are:
Agent and referer information will be written to separate log files (specified by the AgentLog and RefererLog directives)
Include a date stamp in the separate agent and referer logs
Agent and referer fields are included in the transfer log at the end of each record
The server name (from the ServerName directive) is included in the transfer log at the end of each record
Specifies the maximum number of slave processes. The default is 150.
When persistent connections are enabled with KeepAlive On, the MaxKeepAliveRequests directive specifies the number of requests the server will allow per persistent connection. The default is 0 (no limit). (NCSA only)
Specifies how many requests a slave process may handle during its life. For example:
Defines the maximum number of consecutive slave processes. (NCSA only)
Specifies the upper range for how many idle slaves the server should keep around at any given time. The default is 10.
Specifies the lower range for how many idle slaves the server should keep around at any given time. The default is 5.
Specifies the location of the file into which the server should place its process ID when running in standalone mode, as an absolute path or as a relative path from the ServerRoot directory. The default is:
Specifies the server's port, with a default of 80. Many non-standard ports are assigned to 8001.
Specifies what name the server should use in process listings (if configured with the SETPROCTITLE flag). (NCSA only)
Specifies a site to be ignored in the referer log file. (NCSA only)
Specifies the location of the refering URL log file. It may be specified either as an absolute path or as a relative path from the ServerRoot directory. The default is:
Specifies the location of the resource configuration file, as an absolute path or as a relative path from the ServerRoot directory. For example:
Specifies the location of the server status file, used by the server to monitor the status of slave processes, as an absolute path or as a relative path from the ServerRoot directory. The default is:
Script method cgi_script
Specifies a CGI script to be executed when a given request method is used. The method can be GET, POST, PUT, or DELETE.
Specifies the email address to which complaints, suggestions, and questions regarding your server should be sent. Used when the server sends error messages in response to failed requests. This directive has no default. For example:
ServerAlias virtual_hostname real_hostname
Specifies an alternate name for a host.
Allows you to specify the preferred name for your server machine.
Specifies a pathname for a virtual host--that is, requests for this hostname will be automatically routed to the specified pathname. For use within <VirtualHost> sections.
Specifies the directory in which all the server's associated files reside. This path is used as the root directory when relative paths are specified with other directives. For example:
Specifies whether your server is to run in standalone mode or under inetd. The default is to run standalone.
A sectioning directive that can be placed within a <VirtualHost> section in the httpd.conf file. Resource configuration directives specific to the virtual host are placed within a <SRMOptions> section. See <VirtualHost>. (NCSA only)
Specifies the initial number of slave processes at server startup. The default is 5.
Specifies the number of seconds to wait before closing a connection. The default is 1200.
Specifies the location of the transfer log file, as either an absolute path or a relative path to the ServerRoot directory. The default is:
Specifies the location of the MIME types file. As with other configuration paths, the location may be given as either an absolute path or a relative path to the ServerRoot directory. The default is:
Specifies the user and group you want the server process to run as. Either a user name or user ID can be specified; a user ID should be preceded by a number sign (#).
Used when a single server services multiple hostnames. Each hostname is given its own <VirtualHost> directive.
<VirtualHost> has a beginning and ending directive, with other configuration directives for the host entered in between. For Apache, most directives are valid within <VirtualHost> except ServerType, UserId, GroupId, StartServers, MaxSpareServers, MinSpareServers, MaxRequestsPerChild, BindAddress, PidFile, TypesConfig, and ServerRoot. For the NCSA server, most httpd.conf directives are allowed, but srm.conf directives need to be placed within an <SRMOptions> directive embedded in <VirtualHost>.