mod_annot editor

Annotate Section

Configuration Basics

From the point of view of a system administrator, there are several kinds of directive. These can be broadly classified according to their scope and validity in the configuration files. That is to say, some directives are valid only for the server as a whole, while others apply within a scope such as <VirtualHost> or <Directory>.

Conflicting directives may override each other on the basis of specificity. For example, a directive inside a <Directory> overrides one outside it. In most cases this applies recursively, although this is controlled by individual modules whose behaviour may differ.

The standard contexts supported by Apache are:

Main Config
Directives appearing in httpd.conf but not inside any container apply globally, except where overridden. This is appropriate for setting system defaults such as MIME types, and for once-only setup such as loading modules. Most directives can be used here.
Virtual Host
Each Virtual host has it's (virtual) server-wide configuration, set within a <VirtualHost> container. Directives that are valid in the main config are also valid in a virtual host, and vice versa.
Directory
The <Directory>, <Files> and <Location> directives define a hierarchy within which configuration can be set and overridden at any level. This is the most usual form of configuration, and is orthogonal to the virtual hosts. In the interests of brevity, we'll refer to this collectively as the Directory Hierarchy in this article.
htaccess
htaccess is an extension of the Directory Hierarchy that serves to enable users to set directives for themselves, subject to permissions (AllowOverride) set up by the server administrator.

Note that contexts are not always the same as containers. Modules may themselves implement their own containers: for example, mod_access implements <Limit>;, and mod_perl implements <Perl>. These are not relevant to this discussion.