1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
6<html xmlns="http://www.w3.org/1999/xhtml">
7  <head>
8    <meta name="generator" content="HTML Tidy, see www.w3.org" />
9
10    <title>Configuration Files</title>
11  </head>
12  <!-- Background white, links blue (unvisited), navy (visited), red (active) -->
13
14  <body bgcolor="#FFFFFF" text="#000000" link="#0000FF"
15  vlink="#000080" alink="#FF0000">
16        <div align="CENTER">
17      <img src="images/sub.gif" alt="[APACHE DOCUMENTATION]" />
18
19      <h3>Apache HTTP Server</h3>
20    </div>
21
22
23
24    <h1 align="CENTER">Configuration Files</h1>
25
26    <ul>
27      <li><a href="#main">Main Configuration Files</a></li>
28
29      <li><a href="#syntax">Syntax of the Configuration
30      Files</a></li>
31
32      <li><a href="#modules">Modules</a></li>
33
34      <li><a href="#scope">Scope of Directives</a></li>
35
36      <li><a href="#htaccess">.htaccess Files</a></li>
37    </ul>
38    <hr />
39
40    <h2><a id="main" name="main">Main Configuration Files</a></h2>
41
42    <table border="1">
43      <tr>
44        <td valign="top"><strong>Related Modules</strong><br />
45         <br />
46         <a href="mod/mod_mime.html">mod_mime</a><br />
47         </td>
48
49        <td valign="top"><strong>Related Directives</strong><br />
50         <br />
51         <a
52        href="mod/core.html#accessconfig">AccessConfig</a><br />
53         <a
54        href="mod/core.html#ifdefine">&lt;IfDefine&gt;</a><br />
55         <a href="mod/core.html#include">Include</a><br />
56         <a
57        href="mod/core.html#resourceconfig">ResourceConfig</a><br />
58         <a
59        href="mod/mod_mime.html#typesconfig">TypesConfig</a><br />
60         </td>
61      </tr>
62    </table>
63
64    <p>Apache is configured by placing <a
65    href="mod/directives.html">directives</a> in plain text
66    configuration files. The main configuration file is usually
67    called <code>httpd.conf</code>. The location of this file is
68    set at compile-time, but may be overridden with the
69    <code>-f</code> command line flag. Some sites also have
70    <code>srm.conf</code> and <code>access.conf</code> files for <a
71    href="http://httpd.apache.org/info/three-config-files.html">historical
72    reasons</a>. In addition, other configuration files may be
73    added using the <code><a
74    href="mod/core.html#include">Include</a></code> directive. Any
75    directive may be placed in any of these configuration files.
76    Changes to the main configuration files are only recognized by
77    Apache when it is started or restarted.</p>
78
79    <p>New with Apache 1.3.13 is a feature where if any
80    configuration file is actually a directory, Apache will enter
81    that directory and parse any files (and subdirectories) found
82    there as configuration files. One possible use for this would
83    be to add VirtualHosts by creating small configuration files
84    for each host, and placing them in such a configuration
85    directory. Thus, you can add or remove VirtualHosts without
86    editing any files at all, simply adding or deleting them. This
87    makes automating such processes much easier.</p>
88
89    <p>The server also reads a file containing mime document types;
90    the filename is set by the <a
91    href="mod/mod_mime.html#typesconfig">TypesConfig</a> directive,
92    and is <code>mime.types</code> by default.</p>
93    <hr />
94
95    <h2><a id="syntax" name="syntax">Syntax of the Configuration
96    Files</a></h2>
97
98    <p>Apache configuration files contain one directive per line.
99    The back-slash "\" may be used as the last character on a line
100    to indicate that the directive continues onto the next line.
101    There must be no other characters or white space between the
102    back-slash and the end of the line.</p>
103
104    <p>Directives in the configuration files are case-insensitive,
105    but arguments to directives are often case sensitive. Lines
106    which begin with the hash character "#" are considered
107    comments, and are ignored. Comments may <strong>not</strong> be
108    included on a line after a configuration directive. Blank lines
109    and white space occurring before a directive are ignored, so
110    you may indent directives for clarity.</p>
111
112    <p>You can check your configuration files for syntax errors
113    without starting the server by using <code>apachectl
114    configtest</code> or the <code>-t</code> command line
115    option.</p>
116    <hr />
117
118    <h2><a id="modules" name="modules">Modules</a></h2>
119
120    <table border="1">
121      <tr>
122        <td valign="top"><strong>Related Modules</strong><br />
123         <br />
124         <a href="mod/mod_so.html">mod_so</a><br />
125         </td>
126
127        <td valign="top"><strong>Related Directives</strong><br />
128         <br />
129         <a href="mod/core.html#addmodule">AddModule</a><br />
130         <a
131        href="mod/core.html#clearmodulelist">ClearModuleList</a><br />
132         <a
133        href="mod/core.html#ifmodule">&lt;IfModule&gt;</a><br />
134         <a href="mod/mod_so.html#loadmodule">LoadModule</a><br />
135         </td>
136      </tr>
137    </table>
138
139    <p>Apache is a modular server. This implies that only the most
140    basic functionality is included in the core server. Extended
141    features are available through <a
142    href="mod/index-bytype.html">modules</a> which can be loaded
143    into Apache. By default, a <a
144    href="mod/module-dict.html#Status">base</a> set of modules is
145    included in the server at compile-time. If the server is
146    compiled to use <a href="dso.html">dynamically loaded</a>
147    modules, then modules can be compiled separately and added at
148    any time using the <a
149    href="mod/mod_so.html#loadmodule">LoadModule</a> directive.
150    Otherwise, Apache must be recompiled to add or remove modules.
151    Configuration directives may be included conditional on a
152    presence of a particular module by enclosing them in an <a
153    href="mod/core.html#ifmodule">&lt;IfModule&gt;</a> block.</p>
154
155    <p>To see which modules are currently compiled into the server,
156    you can use the <code>-l</code> command line option.</p>
157    <hr />
158
159    <h2><a id="scope" name="scope">Scope of Directives</a></h2>
160
161    <table border="1">
162      <tr>
163        <td valign="top"><strong>Related Directives</strong><br />
164         <br />
165         <a
166        href="mod/core.html#directory">&lt;Directory&gt;</a><br />
167         <a
168        href="mod/core.html#directorymatch">&lt;DirectoryMatch&gt;</a><br />
169         <a href="mod/core.html#files">&lt;Files&gt;</a><br />
170         <a
171        href="mod/core.html#filesmatch">&lt;FilesMatch&gt;</a><br />
172         <a
173        href="mod/core.html#location">&lt;Location&gt;</a><br />
174         <a
175        href="mod/core.html#locationmatch">&lt;LocationMatch&gt;</a><br />
176         <a
177        href="mod/core.html#virtualhost">&lt;VirtualHost&gt;</a><br />
178         </td>
179      </tr>
180    </table>
181
182    <p>Directives placed in the main configuration files apply to
183    the entire server. If you wish to change the configuration for
184    only a part of the server, you can scope your directives by
185    placing them in <code><a
186    href="mod/core.html#directory">&lt;Directory&gt;</a>, <a
187    href="mod/core.html#directorymatch">&lt;DirectoryMatch&gt;</a>,
188    <a href="mod/core.html#files">&lt;Files&gt;</a>, <a
189    href="mod/core.html#filesmatch">&lt;FilesMatch&gt;</a>, <a
190    href="mod/core.html#location">&lt;Location&gt;</a>,</code> and
191    <code><a
192    href="mod/core.html#locationmatch">&lt;LocationMatch&gt;</a></code>
193    sections. These sections limit the application of the
194    directives which they enclose to particular filesystem
195    locations or URLs. They can also be nested, allowing for very
196    fine grained configuration.</p>
197
198    <p>Apache has the capability to serve many different websites
199    simultaneously. This is called <a href="vhosts/">Virtual
200    Hosting</a>. Directives can also be scoped by placing them
201    inside <code><a
202    href="mod/core.html#virtualhost">&lt;VirtualHost&gt;</a></code>
203    sections, so that they will only apply to requests for a
204    particular website.</p>
205
206    <p>Although most directives can be placed in any of these
207    sections, some directives do not make sense in some contexts.
208    For example, directives controlling process creation can only
209    be placed in the main server context. To find which directives
210    can be placed in which sections, check the <a
211    href="mod/directive-dict.html#Context">Context</a> of the
212    directive. For further information, we provide details on <a
213    href="sections.html">How Directory, Location and Files sections
214    work</a>.</p>
215    <hr />
216
217    <h2><a id="htaccess" name="htaccess">.htaccess Files</a></h2>
218
219    <table border="1">
220      <tr>
221        <td valign="top"><strong>Related Directives</strong><br />
222         <br />
223         <a
224        href="mod/core.html#accessfilename">AccessFileName</a><br />
225         <a
226        href="mod/core.html#allowoverride">AllowOverride</a><br />
227         </td>
228      </tr>
229    </table>
230
231    <p>Apache allows for decentralized management of configuration
232    via special files placed inside the web tree. The special files
233    are usually called <code>.htaccess</code>, but any name can be
234    specified in the <a
235    href="mod/core.html#accessfilename"><code>AccessFileName</code></a>
236    directive. Directives placed in <code>.htaccess</code> files
237    apply to the directory where you place the file, and all
238    sub-directories. The <code>.htaccess</code> files follow the
239    same syntax as the main configuration files. Since
240    <code>.htaccess</code> files are read on every request, changes
241    made in these files take immediate effect.</p>
242
243    <p>To find which directives can be placed in
244    <code>.htaccess</code> files, check the <a
245    href="mod/directive-dict.html#Context">Context</a> of the
246    directive. The server administrator further controls what
247    directives may be placed in <code>.htaccess</code> files by
248    configuring the <a
249    href="mod/core.html#allowoverride"><code>AllowOverride</code></a>
250    directive in the main configuration files.</p>
251
252    <p>For more information on <code>.htaccess</code> files, see
253    Ken Coar's tutorial on <a
254    href="http://apache-server.com/tutorials/ATusing-htaccess.html">
255    Using .htaccess Files with Apache</a>, or the <a
256    href="http://httpd.apache.org/docs/howto/htaccess.html">.htaccess
257    tutorial</a> in the Apache docs.</p>
258        <hr />
259
260    <h3 align="CENTER">Apache HTTP Server</h3>
261    <a href="./"><img src="images/index.gif" alt="Index" /></a>
262
263  </body>
264</html>
265
266
267