]> granicus.if.org Git - apache/blob - docs/manual/configuring.xml
remove the relativepath element from the documents.
[apache] / docs / manual / configuring.xml
1 <?xml version='1.0' encoding='UTF-8' ?>
2 <!DOCTYPE manualpage SYSTEM "./style/manualpage.dtd">
3 <?xml-stylesheet type="text/xsl" href="./style/manual.en.xsl"?>
4 <manualpage metafile="configuring.xml.meta">
5
6   <title>Configuration Files</title>
7
8 <summary>
9 <p>This document describes the files used to configure the Apache
10 HTTP server.</p>
11 </summary>
12
13   <section id="main">
14     <title>Main Configuration Files</title>
15     <related>
16       <modulelist>
17         <module>mod_mime</module>
18       </modulelist>
19       <directivelist>
20         <directive module="core" type="section">IfDefine</directive>
21         <directive module="core">Include</directive>
22         <directive module="mod_mime">TypesConfig</directive>
23       </directivelist>
24     </related>
25
26     <p>Apache is configured by placing <a
27     href="mod/directives.html">directives</a> in plain text
28     configuration files. The main configuration file is usually called
29     <code>httpd.conf</code>. The location of this file is set at
30     compile-time, but may be overridden with the <code>-f</code>
31     command line flag. In addition, other configuration files may be
32     added using the <directive module="core">Include</directive>
33     directive, and wildcards can be used to include many configuration
34     files. Any directive may be placed in any of these configuration
35     files.  Changes to the main configuration files are only
36     recognized by Apache when it is started or restarted.</p>
37
38     <p>The server also reads a file containing mime document types;
39     the filename is set by the <directive
40     module="mod_mime">TypesConfig</directive> directive,
41     and is <code>mime.types</code> by default.</p>
42   </section>
43
44   <section id="syntax">
45     <title>Syntax of the Configuration Files</title>
46
47     <p>Apache configuration files contain one directive per line.
48     The back-slash "\" may be used as the last character on a line
49     to indicate that the directive continues onto the next line.
50     There must be no other characters or white space between the
51     back-slash and the end of the line.</p>
52
53     <p>Directives in the configuration files are case-insensitive,
54     but arguments to directives are often case sensitive. Lines
55     that begin with the hash character "#" are considered
56     comments, and are ignored. Comments may <strong>not</strong> be
57     included on a line after a configuration directive. Blank lines
58     and white space occurring before a directive are ignored, so
59     you may indent directives for clarity.</p>
60
61     <p>You can check your configuration files for syntax errors
62     without starting the server by using <code>apachectl
63     configtest</code> or the <code>-t</code> command line
64     option.</p>
65   </section>
66
67   <section id="modules">
68     <title>Modules</title>
69
70     <related>
71       <modulelist>
72         <module>mod_so</module>
73       </modulelist>
74       <directivelist>
75         <directive module="core" type="section">IfModule</directive>
76         <directive module="mod_so">LoadModule</directive>
77       </directivelist>
78     </related>
79
80     <p>Apache is a modular server. This implies that only the most
81     basic functionality is included in the core server. Extended
82     features are available through <a
83     href="mod/">modules</a> which can be loaded
84     into Apache. By default, a <a
85     href="mod/module-dict.html#Status">base</a> set of modules is
86     included in the server at compile-time. If the server is
87     compiled to use <a href="dso.html">dynamically loaded</a>
88     modules, then modules can be compiled separately and added at
89     any time using the <directive module="mod_so">LoadModule</directive>
90     directive.
91     Otherwise, Apache must be recompiled to add or remove modules.
92     Configuration directives may be included conditional on a
93     presence of a particular module by enclosing them in an<directive
94     module="core" type="section">IfModule</directive> block.</p>
95
96     <p>To see which modules are currently compiled into the server,
97     you can use the <code>-l</code> command line option.</p>
98   </section>
99
100   <section id="scope">
101     <title>Scope of Directives</title>
102
103     <related>
104       <directivelist>
105         <directive module="core" type="section">Directory</directive>
106         <directive module="core" type="section">DirectoryMatch</directive>
107         <directive module="core" type="section">Files</directive>
108         <directive module="core" type="section">FilesMatch</directive>
109         <directive module="core" type="section">Location</directive>
110         <directive module="core" type="section">LocationMatch</directive>
111         <directive module="core" type="section">VirtualHost</directive>
112       </directivelist>
113     </related>
114
115     <p>Directives placed in the main configuration files apply to
116     the entire server. If you wish to change the configuration for
117     only a part of the server, you can scope your directives by
118     placing them in <directive module="core"
119     type="section">Directory</directive>, <directive module="core"
120     type="section">DirectoryMatch</directive>, <directive module="core"
121     type="section">Files</directive>, <directive module="core"
122     type="section">FilesMatch</directive>, <directive module="core"
123     type="section">Location</directive>, and <directive module="core"
124     type="section">LocationMatch</directive>
125     sections. These sections limit the application of the
126     directives which they enclose to particular filesystem
127     locations or URLs. They can also be nested, allowing for very
128     fine grained configuration.</p>
129
130     <p>Apache has the capability to serve many different websites
131     simultaneously. This is called <a href="vhosts/">Virtual
132     Hosting</a>. Directives can also be scoped by placing them
133     inside <directive module="core" type="section">VirtualHost</directive>
134     sections, so that they will only apply to requests for a
135     particular website.</p>
136
137     <p>Although most directives can be placed in any of these
138     sections, some directives do not make sense in some contexts.
139     For example, directives controlling process creation can only
140     be placed in the main server context. To find which directives
141     can be placed in which sections, check the <a
142     href="mod/directive-dict.html#Context">Context</a> of the
143     directive. For further information, we provide details on <a
144     href="sections.html">How Directory, Location and Files sections
145     work</a>.</p>
146   </section>
147
148   <section id="htaccess">
149     <title>.htaccess Files</title>
150
151     <related>
152       <directivelist>
153         <directive module="core">AccessFileName</directive>
154         <directive module="core">AllowOverride</directive>
155       </directivelist>
156     </related>
157
158     <p>Apache allows for decentralized management of configuration
159     via special files placed inside the web tree. The special files
160     are usually called <code>.htaccess</code>, but any name can be
161     specified in the <directive module="core">AccessFileName</directive>
162     directive. Directives placed in <code>.htaccess</code> files
163     apply to the directory where you place the file, and all
164     sub-directories. The <code>.htaccess</code> files follow the
165     same syntax as the main configuration files. Since
166     <code>.htaccess</code> files are read on every request, changes
167     made in these files take immediate effect.</p>
168
169     <p>To find which directives can be placed in
170     <code>.htaccess</code> files, check the <a
171     href="mod/directive-dict.html#Context">Context</a> of the
172     directive. The server administrator further controls what
173     directives may be placed in <code>.htaccess</code> files by
174     configuring the <directive module="core">AllowOverride</directive>
175     directive in the main configuration files.</p>
176
177     <p>For more information on <code>.htaccess</code> files, see
178     the <a href="howto/htaccess.html">.htaccess tutorial</a>.</p>
179   </section>
180 </manualpage>