23. Apache and NCSA Server Configuration
Contents:
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. 23.1 Basic Server Configuration--http.confThe 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. AccessConfigAccessConfig filename Specifies the location of the access configuration file, either as an absolute path or as a relative path from the ServerRoot directory. For example:
AccessConfig conf/access.conf ActionAction 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. AgentLogAgentLog filename 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:
AgentLog logs/agent_log Annotation-ServerAnnotation-Server servername 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) AssumeDigestSupportAssumeDigestSupport Specifies whether the server should assume MD5 message digest support on the client end. BindAddressBindAddress hostname 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:
BindAddress www.ora.com
CacheNegotiatedDocsCacheNegotiatedDocs Tells the server to allow remote proxy servers to cache negotiated documents. By default, Apache does not allow caching of negotiated documents. ErrorLogErrorLog filename Specifies the location of the error log file, either an absolute path or relative path to the ServerRoot directory. The default setting is:
ErrorLog logs/error_log CoreDirectoryCoreDirectory filename 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) DNSModeDNSMode None|Minimum|Standard|Maximum Controls how often and under what circumstances the server will attempt reverse DNS lookup of the client host. Possible values are: NoneNo DNS lookup under any circumstances MinimumDNS lookup only for resolving access permissions StandardDNS lookup for every request (default) MaximumDNS lookup both to get a name for the address, and to confirm that the name can resolve back to that address (NCSA only) GroupGroup groupname 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 (#). IdentityCheckIdentityCheck On|Off 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. KeepAliveKeepAlive On|Off Tells the server to allow persistent connections (default=off). See also KeepAliveTimeOut and MaxKeepAliveRequests. KeepAliveTimeOutKeepAliveTimeOut seconds 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. ListenListen [ 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. LogDirGroupWriteOkLogDirGroupWriteOk Specifies whether the server should be willing to start if any of the log files are in directories that are group writeable. (NCSA only) LogDirPublicWriteOkLogDirPublicWriteOk Specifies whether the server should be willing to start if any of the log files are in directories that are world writeable. (NCSA only) LogOptionsLogOptions options Specifies how log information should be written to the various log files. Options are: SeparateAgent and referer information will be written to separate log files (specified by the AgentLog and RefererLog directives) DateInclude a date stamp in the separate agent and referer logs CombinedAgent and referer fields are included in the transfer log at the end of each record ServernameThe server name (from the ServerName directive) is included in the transfer log at the end of each record (NCSA only) MaxKeepAliveRequestsMaxKeepAliveRequests number 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) MaxRequestsPerChildMaxRequestsPerChild number Specifies how many requests a slave process may handle during its life. For example:
MaxRequestsPerChild 300 MaxSpareServersMaxSpareServers number Specifies the upper range for how many idle slaves the server should keep around at any given time. The default is 10. MinSpareServersMinSpareServers number Specifies the lower range for how many idle slaves the server should keep around at any given time. The default is 5. PidFilePidFile filename 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:
PidFile logs/httpd.pid PortPort number Specifies the server's port, with a default of 80. Many non-standard ports are assigned to 8001. ProcessNameProcessName name Specifies what name the server should use in process listings (if configured with the SETPROCTITLE flag). (NCSA only) RefererIgnoreRefererIgnore hostname Specifies a site to be ignored in the referer log file. (NCSA only) RefererLogRefererLog filename 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:
RefererLog logs/referer_log ResourceConfigResourceConfig filename Specifies the location of the resource configuration file, as an absolute path or as a relative path from the ServerRoot directory. For example:
ResourceConfig srm.conf ScoreBoardFileScoreBoardFile filename 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:
ScoreBoardFile logs/apache_runtime_status ScriptScript 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. ServerAdminServerAdmin email_address 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:
ServerAdmin webmaster@ora.com ServerPathServerPath pathname 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. ServerRootServerRoot directory_path 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:
ServerRoot /usr/local/etc/httpd/ ServerTypeServerType standalone|inetd Specifies whether your server is to run in standalone mode or under inetd. The default is to run standalone. <SRMOptions><SRMOptions> ...</SRMOptions> 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) StartServersStartServers number Specifies the initial number of slave processes at server startup. The default is 5. TimeOutTimeOut seconds Specifies the number of seconds to wait before closing a connection. The default is 1200. TransferLogTransferLog filename Specifies the location of the transfer log file, as either an absolute path or a relative path to the ServerRoot directory. The default is:
TransferLog logs/access_log TypesConfigTypesConfig filename 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:
TypesConfig conf/mime.types UserUser username 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 (#). <VirtualHost><VirtualHost hostname>...</VirtualHost> 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>. |
|