start page | rating of books | rating of authors | reviews | copyrights

Webmaster in a Nutshell

Previous Chapter 23
Apache and NCSA Server Configuration
Next
 

23.2 Resource Configuration--srm.conf

The srm.conf file is for server resource management--i.e., how local resources (e.g., documents) should be handled when requested by a client.

AccessFileName

AccessFileName filename

Specifies the name of directory access control files. The default is:

AccessFileName .htaccess

AddAlt

AddAlt text filenames/suffixes ...

Specifies alternative text for icons used with a given file listing in a directory index. The text is used as the first argument to the directive, followed by one or more file extensions or names. For example:

AddAlt IMAGE .gif .jpg .png
AddAlt LOGO logo.gif

AddAltByEncoding

AddAltByEncoding text encoding_type

Works similarly to AddAlt, except that it specifies alt text based on the MIME content encoding of the file being listed. For example, to specify the alt text "gzip" for a file encoded with gzip, the directive would be:

AddAltByEncoding gzip x-gzip

AddAltByType

AddAltByType text mime_type

Works similarly to AddAlt, except that it specifies alt text based on the media type of the file being listed. For example, to use the alt text "IMAGE" for all image files, the directive would be:

AddAltByType IMAGE image/*

AddDescription

AddDescription text suffixes ...

Used to associate a descriptive text phrase with a particular type of file. The text appears to the right of the file name in a directory index. The descriptive text must be surrounded by quotes and be fairly short. Files can be associated by extension or name. For example:

AddDescription "GIF Image File" .gif

AddEncoding

AddEncoding encoding-type suffixes ...

Allows you to specify which MIME encodings should be associated with documents from your server. Encodings beginning with x- are used for unofficial encodings. For example:

AddEncoding x-gzip gz

AddIcon

AddIcon pathname suffixes ...

Specifies an icon image to be displayed with a given type of file in a directory index. For example:

AddIcon /icons/image.gif .gif .jpg .png

An alternative syntax allows you to specify alt text in this directive as well:

AddIcon (IMAGE,/icons/image.gif) .gif .jpg .png

There are three special values that can be used for the file extensions in the AddIcon directive:

^^DIRECTORY^^

The icon will be used for subdirectory names.

..

The icon will be used for the parent directory.

^^BLANKICON^^

The icon is used only for spacing in the header of the page.

AddIconByEncoding

AddIconByEncoding filename encoding_type

Specifies an icon to be displayed with a file in a directory index based on the file's encoding. Similar to the AddIcon directive, it can also specify alt text. For example:

AddIconByEncoding /icons/gzip.gif x-gzip
AddIconByEncoding (GZIP,/icons/gzip.gif) x-gzip

AddIconByType

AddIconByType filename mime_type

Specifies an icon to be displayed with a file in a directory index based on the file's media type. The directive may also specify alt text. For example:

AddIconByType /icons/image.gif image/*
AddIconByType (IMAGE,/icons/image.gif) image/*

AddLanguage

AddLanguage language suffix

Specifies that a certain extension should be associated with a certain language for purposes of content negotiation. For example, to associate the extension .francais with French documents, use the following setting:

AddLanguage fr .francais

AddType

AddType mime_type suffix|filename

Specifies a MIME type and subtype to be associated with certain file extensions. For example, if you want to serve a Microsoft Word document:

AddType application/msword .doc

AddType directives will override any extension-to-type mappings you have in your mime.types file.

Alias

Alias symbolic_path real_path

Creates a virtual name or directory by mapping a virtual pathname that is used in a URL to a real path on your server. Aliasing is useful for organizing your server documents, keeping URLs simpler for users, and hiding the structure of your file system. For example, the icon directory is aliased in the default configuration file:

Alias /icons/ /usr/local/etc/httpd/icons

With this setting, a request for /icons/image.gif is handled by sending the file /usr/local/etc/httpd/icons/image.gif.

DefaultIcon

DefaultIcon filename

Specifies what icon to use when none has been assigned by one of the AddIcon* directives.

DefaultType

DefaultType mime_type

Establishes a default MIME type to be returned to a browser if the mappings found in the mime.types file are not adequate. The default is text/html.

DirectoryIndex

DirectoryIndex filenames ...

Specifies the file that is returned when a URL identifies a directory on your server and no filename. If more than one file is listed, the first one that is present in the directory will be returned. The default is:

DirectoryIndex index.html index.shtml index.cgi

DocumentRoot

DocumentRoot directory_path

Specifies the root of the server document tree. For example:

DocumentRoot /usr/local/etc/httpd/htdocs/

ErrorDocument

ErrorDocument code filename|string|URL

Allows you to customize the response sent by your server when an error is encountered. The error code is an HTTP status code as listed in Chapter 18, Server Response Codes. Possible values are:

filename

A local file to return upon retrieving this error

string

A message to return upon retrieving this error. The string must be surrounded by quotes.

URL

A remote document to redirect the user to upon retrieving this error

For example:

ErrorDocument 404 /errors/notfound.html
ErrorDocument 408 "Sorry, the server timed out
 - try again later"
ErrorDocument 402 http://www.ora.com/payment/

Note: the NCSA server only supports the filename syntax for this directive.

FancyIndexing

FancyIndexing On|Off

Specifies that the server should create a fancy index for a directory listing, including filenames and icons representing the files' types, sizes, and last-modified dates. By default, fancy indexing is off.

ForceType

ForceType mime_type

Specifies that all files in this directory should be served with the specified type. Appropriate for inclusion in .htaccess files or within <Directory> section directives.

HeaderName

HeaderName filename

Specifies a file to be prepended to a file listing when generating a directory index. The example file uses the following setting:

HeaderName HEADER

The server will look for this file name first with an .html extension, and failing that, without an extension.

ImapMenu

ImapMenu option

Under Apache, if an imagemap is called without valid coordinates, the server can return a menu of the items in the imagemap file. ImapMenu configures that menu. Options are:

none

No menu is created. The action specified with ImapDefault is taken.

formatted

A formatted menu is generated, with a listing of the possible links.

semiformatted

A menu with comments from the imagemap file and simple breaks is generated, with a listing of the possible links.

unformatted

A menu with the text of the imagemap file, unformatted. Useful if map files are written as HTML.

ImapDefault

ImapDefault option|URL

Specifies the default action for imagemap files, if there is no default directive in the imagemap file itself. A URL can be specified, or one of the following options:

error

Fails with a server response code of 500 (See Chapter 18, Server Response Codes).

nocontent

Sends a server response code of 204, telling the client to keep the same page displayed (see Chapter 18, Server Response Codes).

map

Uses the URL of the imagemap file, without coordinates (so a menu is generated unless specified otherwise).

referer

Uses the referring document, or the server root if a Referer header is not specified.

ImapBase

ImapBase option|URL

Specifies the default base for imagemap files, if there is no base directive in the imagemap file itself. A URL can be specified, or one of the following options:

map

Uses the URL of the imagemap file, without coordinates (so a menu is generated unless specified otherwise).

referer

Uses the referring document, or the server root if a Referer header is not specified.

IndexIgnore

IndexIgnore filenames ...

Tells the server to ignore certain files when building a directory index on the fly. The files are specified as full server paths, and you can use the wildcards * and ? with their usual meanings. Thus, to ignore all hidden files (i.e., files whose names begin with a period) at every level, you could use the following setting:

IndexIgnore */.?*

Any number of IndexIgnore directives may be included.

IndexOptions

IndexOptions options ...

Specifies a number of options to use when creating a directory index on the fly. Possible options are:

None

Generate only plain directory indexes.

FancyIndexing

Equivalent to FancyIndexing On. Unless fancy indexing is turned on by either method, the other index options (except None) are ignored.

IconsAreLinks

Make the icons link to the documents (in addition to making the names link).

ScanHTMLTitles

Scan any HTML files in the directory, extract their titles, and use them as descriptions for the files.

SuppressLastMod

Omit the last-modified date from the fancy index.

SuppressSize

Omit the size from the fancy index.

SuppressDesc

Omit the description from the fancy index.

LanguagePriority

LanguagePriority languages ...

Allows you to specify a ranking of languages, which is used in the event that a user's preferences are equal among language choices. For example:

LanguagePriority de it

specifies German before Italian.

ReadmeName

ReadmeName filename

Specifies a file to be appended to a file listing when generating a directory index. The example file uses the following setting:

ReadmeName README

The server will look for this filename first with an .html extension, and failing that, without an extension.

Redirect

Redirect pathname url

Tells the server to forward clients that request a given directory or document to a new location.

ScriptAlias

ScriptAlias symbolic_path real_path

Creates a virtual directory of CGI programs by mapping a virtual pathname that is used in a URL to a real directory of executable CGI programs on your server. Instead of returning a document in that directory, the server will run it within a CGI environment and return the output.

See Chapter 9, CGI Overview, for more information on CGI.

SetHandler

SetHandler handler

Specifies that all files in the directory should be passed through the specified handler. Values are:

cgi-script

All files treated as CGI scripts (see Chapter 9, CGI Overview)

imap-file

All files treated as imagemap files

send-as-is

All files sent without additional server-supplied HTTP headers

server-info

All files sent with server configuration information

server-parsed

All files parsed as server-side includes (see Chapter 13, Server Side Includes).

type-map

All files parsed as type map files for content negotiation

UserDir

UserDir directory_path

Specifies the path within each user's home directory for their Web directories. The default value is public_html. To disable user directories, use this value:

UserDir DISABLED

XBitHack

XBitHack on|off|full

Specifies the parsing of executable HTML documents. Options are:

on

Files that are user-executable are treated as a server-parsed HTML document (SPML).

off

Executable files are treated like regular files.

full

Files that are both user and group executable have the last modified time altered to match that of the returned document.


Previous Home Next
Basic Server Configuration--http.conf Book Index Access Configuration--access.conf

HTML: The Definitive Guide CGI Programming JavaScript: The Definitive Guide Programming Perl WebMaster in a Nutshell