mirror of
https://github.com/apache/httpd.git
synced 2025-06-04 21:42:15 +03:00
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@96194 13f79535-47bb-0310-9956-ffa450edef68
131 lines
11 KiB
Plaintext
131 lines
11 KiB
Plaintext
<html xmlns="http://www.w3.org/TR/xhtml1/strict"><head><!--
|
|
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
|
This file is generated from xml source: DO NOT EDIT
|
|
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
|
--><title>Configuration Files- Apache HTTP Server</title><link href="./style/manual.css" type="text/css" rel="stylesheet"/></head><body><blockquote><div align="center"><img src="./images/sub.gif" alt="[APACHE DOCUMENTATION]"/><h3>Apache HTTP Server Version 2.0</h3></div><h1 align="center">Apache Module
|
|
Configuration Files</h1>
|
|
<p>This document describes the files used to configure the Apache
|
|
HTTP server.</p>
|
|
<ul><li><a href="#main">Main Configuration Files</a></li><li><a href="#syntax">Syntax of the Configuration Files</a></li><li><a href="#modules">Modules</a></li><li><a href="#scope">Scope of Directives</a></li><li><a href="#htaccess">.htaccess Files</a></li></ul><hr/><h2><a name="main">Main Configuration Files</a></h2>
|
|
|
|
<table border="1"><tr><td valign="top"><strong>Related Modules</strong><br/><br/><code><a href="./mod/mod_mime.html">mod_mime</a></code><br/></td><td valign="top"><strong>Related Directives</strong><br/><br/><a href="./mod/core.html#ifdefine" class="directive"><code class="directive"><IfDefine></code></a><br/><a href="./mod/core.html#include" class="directive"><code class="directive">Include</code></a><br/><a href="./mod/mod_mime.html#typesconfig" class="directive"><code class="directive">TypesConfig</code></a><br/></td></tr></table>
|
|
|
|
<p>Apache is configured by placing <a href="mod/directives.html">directives</a> in plain text
|
|
configuration files. The main configuration file is usually
|
|
called <code>httpd.conf</code>. The location of this file is
|
|
set at compile-time, but may be overridden with the
|
|
<code>-f</code> command line flag. In addition, other
|
|
configuration files may be added using the <a href="./mod/core.html#include" class="directive"><code class="directive">Include</code></a> directive. Any
|
|
directive may be placed in any of these configuration files.
|
|
Changes to the main configuration files are only recognized by
|
|
Apache when it is started or restarted.</p>
|
|
|
|
<p>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.</p>
|
|
|
|
<p>The server also reads a file containing mime document types;
|
|
the filename is set by the <a href="./mod/mod_mime.html#typesconfig" class="directive"><code class="directive">TypesConfig</code></a> directive,
|
|
and is <code>mime.types</code> by default.</p>
|
|
<h2><a name="syntax">Syntax of the Configuration Files</a></h2>
|
|
|
|
|
|
<p>Apache 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.</p>
|
|
|
|
<p>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 <strong>not</strong> 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.</p>
|
|
|
|
<p>You can check your configuration files for syntax errors
|
|
without starting the server by using <code>apachectl
|
|
configtest</code> or the <code>-t</code> command line
|
|
option.</p>
|
|
<h2><a name="modules">Modules</a></h2>
|
|
|
|
|
|
<table border="1"><tr><td valign="top"><strong>Related Modules</strong><br/><br/><code><a href="./mod/mod_so.html">mod_so</a></code><br/></td><td valign="top"><strong>Related Directives</strong><br/><br/><a href="./mod/core.html#addmodule" class="directive"><code class="directive">AddModule</code></a><br/><a href="./mod/core.html#clearmodulelist" class="directive"><code class="directive">ClearModuleList</code></a><br/><a href="./mod/core.html#ifmodule" class="directive"><code class="directive"><IfModule></code></a><br/><a href="./mod/mod_so.html#loadmodule" class="directive"><code class="directive">LoadModule</code></a><br/></td></tr></table>
|
|
|
|
<p>Apache is a modular server. This implies that only the most
|
|
basic functionality is included in the core server. Extended
|
|
features are available through <a href="mod/index-bytype.html">modules</a> which can be loaded
|
|
into Apache. By default, a <a href="mod/module-dict.html#Status">base</a> set of modules is
|
|
included in the server at compile-time. If the server is
|
|
compiled to use <a href="dso.html">dynamically loaded</a>
|
|
modules, then modules can be compiled separately and added at
|
|
any time using the <a href="./mod/mod_so.html#loadmodule" class="directive"><code class="directive">LoadModule</code></a>
|
|
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<a href="./mod/core.html#ifmodule" class="directive"><code class="directive"><IfModule></code></a> block.</p>
|
|
|
|
<p>To see which modules are currently compiled into the server,
|
|
you can use the <code>-l</code> command line option.</p>
|
|
<h2><a name="scope">Scope of Directives</a></h2>
|
|
|
|
|
|
<table border="1"><tr><td valign="top"><strong>Related Modules</strong><br/><br/></td><td valign="top"><strong>Related Directives</strong><br/><br/><a href="./mod/core.html#directory" class="directive"><code class="directive"><Directory></code></a><br/><a href="./mod/core.html#directorymatch" class="directive"><code class="directive"><DirectoryMatch></code></a><br/><a href="./mod/core.html#files" class="directive"><code class="directive"><Files></code></a><br/><a href="./mod/core.html#filesmatch" class="directive"><code class="directive"><FilesMatch></code></a><br/><a href="./mod/core.html#location" class="directive"><code class="directive"><Location></code></a><br/><a href="./mod/core.html#locationmatch" class="directive"><code class="directive"><LocationMatch></code></a><br/><a href="./mod/core.html#virtualhost" class="directive"><code class="directive"><VirtualHost></code></a><br/></td></tr></table>
|
|
|
|
<p>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 <a href="./mod/core.html#directory" class="directive"><code class="directive"><Directory></code></a>, <a href="./mod/core.html#directorymatch" class="directive"><code class="directive"><DirectoryMatch></code></a>, <a href="./mod/core.html#files" class="directive"><code class="directive"><Files></code></a>, <a href="./mod/core.html#filesmatch" class="directive"><code class="directive"><FilesMatch></code></a>, <a href="./mod/core.html#location" class="directive"><code class="directive"><Location></code></a>, and <a href="./mod/core.html#locationmatch" class="directive"><code class="directive"><LocationMatch></code></a>
|
|
sections. These sections limit the application of the
|
|
directives which they enclose to particular filesystem
|
|
locations or URLs. They can also be nested, allowing for very
|
|
fine grained configuration.</p>
|
|
|
|
<p>Apache has the capability to serve many different websites
|
|
simultaneously. This is called <a href="vhosts/">Virtual
|
|
Hosting</a>. Directives can also be scoped by placing them
|
|
inside <a href="./mod/core.html#virtualhost" class="directive"><code class="directive"><VirtualHost></code></a>
|
|
sections, so that they will only apply to requests for a
|
|
particular website.</p>
|
|
|
|
<p>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 <a href="mod/directive-dict.html#Context">Context</a> of the
|
|
directive. For further information, we provide details on <a href="sections.html">How Directory, Location and Files sections
|
|
work</a>.</p>
|
|
<h2><a name="htaccess">.htaccess Files</a></h2>
|
|
|
|
|
|
<table border="1"><tr><td valign="top"><strong>Related Modules</strong><br/><br/></td><td valign="top"><strong>Related Directives</strong><br/><br/><a href="./mod/core.html#accessfilename" class="directive"><code class="directive">AccessFileName</code></a><br/><a href="./mod/core.html#allowoverride" class="directive"><code class="directive">AllowOverride</code></a><br/></td></tr></table>
|
|
|
|
<p>Apache allows for decentralized management of configuration
|
|
via special files placed inside the web tree. The special files
|
|
are usually called <code>.htaccess</code>, but any name can be
|
|
specified in the <a href="./mod/core.html#accessfilename" class="directive"><code class="directive">AccessFileName</code></a>
|
|
directive. Directives placed in <code>.htaccess</code> files
|
|
apply to the directory where you place the file, and all
|
|
sub-directories. The <code>.htaccess</code> files follow the
|
|
same syntax as the main configuration files. Since
|
|
<code>.htaccess</code> files are read on every request, changes
|
|
made in these files take immediate effect.</p>
|
|
|
|
<p>To find which directives can be placed in
|
|
<code>.htaccess</code> files, check the <a href="mod/directive-dict.html#Context">Context</a> of the
|
|
directive. The server administrator further controls what
|
|
directives may be placed in <code>.htaccess</code> files by
|
|
configuring the <a href="./mod/core.html#allowoverride" class="directive"><code class="directive">AllowOverride</code></a>
|
|
directive in the main configuration files.</p>
|
|
|
|
<p>For more information on <code>.htaccess</code> files, see
|
|
Ken Coar's tutorial on <a href="http://apache-server.com/tutorials/ATusing-htaccess.html">
|
|
Using .htaccess Files with Apache</a>.</p>
|
|
</blockquote><h3 align="center">Apache HTTP Server Version 2.0</h3><a href="./"><img src="./images/index.gif" alt="Index"/></a><a href="./"><img src="./images/home.gif" alt="Home"/></a></body></html> |