home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam    

Book HomeWebmaster in a Nutshell, 3rd EditionSearch this book

18.2. Basic Server Configuration: Core Directives

The following section contains core directives that are independent of modules and can be used in the Apache server at all times. With each directive, we indicate any version constraints that are required, as well as the context the directive should appear in. Contexts include:

server config
The directive is allowed in the httpd.conf or srm.conf configuration files.

The directive can appear inside a <VirtualHost> subsection, stating that the directive applies to a virtual server.

The directive can appear inside a <Directory> subsection, stating that the directive applies to a specific directory tree on the server.

The directive can appear inside the per-directory .htaccess access control files.

Directives pertaining to specific Apache modules are covered in Chapter 19.


AcceptPathInfo on|off|default

Determines if extra information following a valid URL pathname is accepted by the server or not. An off value means that a request is rejected if the pathname doesn't match exactly a server resource. on means that the server ignores the extra path information and returns the resource that will match a valid part of the path. The default setting allows the default handler to determine action. If the resource is a CGI script, extra path info may be allowed, but not if the request is for a file.


AddDefaultCharSet on|off|charset

Specifies whether the server will add a default CharSet header to outgoing HTTP headers that do not have a Content Type set. If set to on the default Apache charset will be used. Otherwise, you can provide the character set string you wish.


CGIMapExtension path extension

[Within <Directory> or .htaccess]

Provides an alternative method for assigning a script interpreter to a given file extension.


FileETag flags

Configures how the server forms the ETag response header used for network cache management. The header value is formed from a combination of certain file attributes. The flag keywords can be used in the directive with a plus or minus in front of them to indicate if they will be included or excluded from the determination with respect to a broader scope. The flags are:

The file's inode number

The last-modified data and time of the file

The size of the file

All indicates all three attributes should be used. None specifies that no ETag value should be added.


ForceType mime-type

[Within <Directory> or .htaccess]

Forces all files in its scope to be served as the specified MIME type.


<LimitExcept methods> ... </LimitExcept>

The reverse functionality of the <Limit> directive. <LimitExcept> restricts any methods that are not listed as parameters.


LimitRequestBody size

Limits the maximum size in bytes of the body of a client request. This setting can assist in addressing abnormal requests and some denial of service attacks. The default is 0.


LimitRequestFields n

[server config]

Limits the maximum number of HTTP headers accepted in a client request. This setting can assist in addressing abnormal requests and some denial of service attacks. The default is 100.


LimitRequestFieldsize size

[server config]

Limits the size in bytes of header fields accepted from a client request. The default is 8190.


LimitRequestLine size

[server config]

Limits the maximum size of the request line in a client request. The request line contains the HTTP method the URI of the requested resource and the protocol version number. This directive effectively limits the length of the URI. The request URI can vary widely in length, since it may contain extra-path info or CGI query strings. The default is 16380.


LimitXMLRequestBody size

Limits the size in bytes of the body of an XML request that the server will accept. This setting would relate to SOAP requests and other XML-based services. The default is 0.


MaxMemFree number

[server config]

Specifies the amount of memory (in KBytes) that can be held by the main allocator before calling free( ). A zero value or no setting is equivalent to no limit at all.


SetHandler handler

Specifies a special handler for files requested from the location where this directive is used.


SetInputFilter filter[; filter2; filter3;...

Specifies a filter or filters to process client requests.


SetOutputFilter filter[; filter2; filter3;...>

Specifes a filter or filters to process server responses before they are sent to the client.