|
||||||
| Admin guide | Apache guide | FAQ | ||||||
Configuration Files
Main Configuration Files
Apache is configured by placing directives in plain text configuration files. The main
configuration file is usually called New with Apache 1.3.13 is a feature where if any configuration file is actually a directory, Apache will enter that directory and parse any files (and subdirectories) found there as configuration files. One possible use for this would be to add VirtualHosts by creating small configuration files for each host, and placing them in such a configuration directory. Thus, you can add or remove VirtualHosts without editing any files at all, simply adding or deleting them. This makes automating such processes much easier.
The server also reads a file containing mime document types; the
filename is set by the TypesConfig directive, and is Syntax of the Configuration FilesApache configuration files contain one directive per line. The back-slash "\" may be used as the last character on a line to indicate that the directive continues onto the next line. There must be no other characters or white space between the back-slash and the end of the line. Directives in the configuration files are case-insensitive, but arguments to directives are often case sensitive. Lines which begin with the hash character "#" are considered comments, and are ignored. Comments may not be included on a line after a configuration directive. Blank lines and white space occurring before a directive are ignored, so you may indent directives for clarity. You can check your configuration files for syntax errors without
starting the server by using Modules
Apache is a modular server. This implies that only the most basic functionality is included in the core server. Extended features are available through modules which can be loaded into Apache. By default, a base set of modules is included in the server at compile-time. If the server is compiled to use dynamically loaded modules, then modules can be compiled separately and added at any time using the LoadModule directive. Otherwise, Apache must be recompiled to add or remove modules. Configuration directives may be included conditional on a presence of a particular module by enclosing them in an <IfModule> block. To see which modules are currently compiled into the server,
you can use the Scope of Directives
Directives placed in the main configuration files apply to the entire
server. If you wish to change the configuration for only a part of
the server, you can scope your directives by placing them in
Apache has the capability to serve many different websites
simultaneously. This is called Virtual Hosting.
Directives can also be scoped by placing them inside
Although most directives can be placed in any of these sections, some directives do not make sense in some contexts. For example, directives controlling process creation can only be placed in the main server context. To find which directives can be placed in which sections, check the Context of the directive. For further information, we provide details on How Directory, Location and Files sections work. .htaccess Files
Apache allows for decentralized management of configuration via
special files placed inside the web tree. The special files are
usually called To find which directives can be placed in Log filessecurity warningAnyone who can write to the directory where Apache is writing a log file can almost certainly gain access to the uid that the server is started as, which is normally root. Do NOT give people write access to the directory the logs are stored in without being aware of the consequences; see the security tips document for details.pid fileOn startup, Apache saves the process id of the parent httpd process to
the file If the process dies (or is killed) abnormally, then it will be necessary to kill the children httpd processes. Error logThe server will log error messages to a log file, by default
Transfer logThe server will typically log each request to a transfer file, by
default |
|
|