]> granicus.if.org Git - apache/blob - docs/manual/configuring.html.en
Eliminate duplicate info and add references to logs.html.
[apache] / docs / manual / configuring.html.en
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
2 <HTML>
3 <HEAD>
4 <TITLE>Configuration Files</TITLE>
5 </HEAD>
6
7 <!-- Background white, links blue (unvisited), navy (visited), red (active) -->
8 <BODY
9  BGCOLOR="#FFFFFF"
10  TEXT="#000000"
11  LINK="#0000FF"
12  VLINK="#000080"
13  ALINK="#FF0000"
14 >
15 <!--#include virtual="header.html" -->
16 <H1 ALIGN="CENTER">Configuration Files</H1>
17
18 <ul>
19 <li><a href="#main">Main Configuration Files</a></li>
20 <li><a href="#syntax">Syntax of the Configuration Files</a></li>
21 <li><a href="#modules">Modules</a></li>
22 <li><a href="#scope">Scope of Directives</a></li>
23 <li><a href="#htaccess">.htaccess Files</a></li>
24 </ul>
25
26 <hr>
27
28 <H2><a name="main">Main Configuration Files</a></H2>
29
30 <table border="1"><tr><td valign="top">
31 <strong>Related Modules</strong><br><br>
32 <a href="mod/mod_mime.html">mod_mime</a><br>
33 </td>
34
35 <td valign="top">
36 <strong>Related Directives</strong><br><br>
37 <A HREF="mod/core.html#ifdefine">&lt;IfDefine&gt;</A><br>
38 <a href="mod/core.html#include">Include</a><br>
39 <A HREF="mod/mod_mime.html#typesconfig">TypesConfig</A><br>
40 </td></tr></table>
41
42 <P>Apache is configured by placing <A HREF="mod/directives.html"
43 >directives</A> in plain text configuration files.  The main
44 configuration file is usually called <CODE>httpd.conf</CODE>.  The
45 location of this file is set at compile-time, but may be overridden
46 with the <CODE>-f</CODE> command line flag.  In addition, other
47 configuration files may be added using the <CODE><A
48 HREF="mod/core.html#include">Include</A></CODE> directive.  Any
49 directive may be placed in any of these configuration files.  Changes
50 to the main configuration files are only recognized by Apache when it
51 is started or restarted.</p>
52
53 <P>New with Apache 1.3.13 is a feature where if any configuration
54 file is actually a directory, Apache will enter that directory
55 and parse any files (and subdirectories) found there as configuration
56 files. One possible use for this would be to add VirtualHosts
57 by creating small configuration files for each host, and placing
58 them in such a configuration directory. Thus, you can add or
59 remove VirtualHosts without editing any files at all, simply
60 adding or deleting them. This makes automating such processes
61 much easier.
62
63 <P>
64 The server also reads a file containing mime document types; the
65 filename is set by the <A HREF="mod/mod_mime.html#typesconfig"
66 >TypesConfig</A> directive, and is <CODE>mime.types</CODE> by default.
67
68 <hr>
69
70 <H2><a name="syntax">Syntax of the Configuration Files</a></H2>
71
72 <P>Apache configuration files contain one directive per line.  The
73 back-slash "\" may be used as the last character on a line to indicate
74 that the directive continues onto the next line.  There must be no
75 other characters or white space between the back-slash and the end of
76 the line.
77
78 <P>Directives in the configuration files are case-insensitive, but
79 arguments to directives are often case sensitive.  Lines which begin
80 with the hash character "#" are considered comments, and are ignored.
81 Comments may <STRONG>not</STRONG> be included on a line after a
82 configuration directive.  Blank lines and white space occurring before
83 a directive are ignored, so you may indent directives for clarity.
84
85 <P>You can check your configuration files for syntax errors without
86 starting the server by using <CODE>apachectl configtest</CODE>
87 or the <CODE>-t</CODE> command line option.
88
89 <hr>
90
91 <H2><a name="modules">Modules</a></H2>
92
93 <table border="1"><tr><td valign="top">
94 <strong>Related Modules</strong><br><br>
95 <a href="mod/mod_so.html">mod_so</a><br>
96 </td>
97 <td valign="top">
98 <strong>Related Directives</strong><br><br>
99 <A HREF="mod/core.html#addmodule">AddModule</A><br>
100 <A HREF="mod/core.html#clearmodulelist">ClearModuleList</A><br>
101 <A HREF="mod/core.html#ifmodule">&lt;IfModule&gt;</A><br>
102 <a href="mod/mod_so.html#loadmodule">LoadModule</a><br>
103 </td></tr></table>
104
105 <P>Apache is a modular server.  This implies that only the most basic
106 functionality is included in the core server.  Extended features are
107 available through <A HREF="mod/index-bytype.html">modules</A> which
108 can be loaded into Apache.  By default, a <A
109 HREF="mod/module-dict.html#Status">base</A> set of modules is
110 included in the server at compile-time.  If the server is compiled to
111 use <A HREF="dso.html">dynamically loaded</A> modules, then modules
112 can be compiled separately and added at any time using the <A
113 HREF="mod/mod_so.html#loadmodule">LoadModule</A> directive.
114 Otherwise, Apache must be recompiled to add or remove modules.
115 Configuration directives may be included conditional on a presence of
116 a particular module by enclosing them in an <A
117 HREF="mod/core.html#ifmodule">&lt;IfModule&gt;</A> block.
118
119 <P>To see which modules are currently compiled into the server,
120 you can use the <CODE>-l</CODE> command line option.
121
122 <hr>
123
124 <H2><a name="scope">Scope of Directives</a></H2>
125
126 <table border="1"><tr><td valign="top">
127 <strong>Related Directives</strong><br><br>
128 <A HREF="mod/core.html#directory">&lt;Directory&gt;</A><br>
129 <A HREF="mod/core.html#directorymatch">&lt;DirectoryMatch&gt;</A><br>
130 <A HREF="mod/core.html#files">&lt;Files&gt;</A><br>
131 <A HREF="mod/core.html#filesmatch">&lt;FilesMatch&gt;</A><br>
132 <A HREF="mod/core.html#location">&lt;Location&gt;</A><br>
133 <A HREF="mod/core.html#locationmatch">&lt;LocationMatch&gt;</A><br>
134 <a href="mod/core.html#virtualhost">&lt;VirtualHost&gt;</a><br>
135 </td></tr></table>
136
137 <P>Directives placed in the main configuration files apply to the entire
138 server.  If you wish to change the configuration for only a part of
139 the server, you can scope your directives by placing them in 
140 <CODE><A HREF="mod/core.html#directory">&lt;Directory&gt;</A>,
141 <A HREF="mod/core.html#directorymatch">&lt;DirectoryMatch&gt;</A>,
142 <A HREF="mod/core.html#files">&lt;Files&gt;</A>,
143 <A HREF="mod/core.html#filesmatch">&lt;FilesMatch&gt;</A>,
144 <A HREF="mod/core.html#location">&lt;Location&gt;</A>,
145 </CODE> and <CODE>
146 <A HREF="mod/core.html#locationmatch">&lt;LocationMatch&gt;</A>
147 </CODE>
148 sections.  These sections limit the application of the directives
149 which they enclose to particular filesystem locations or URLs.  They
150 can also be nested, allowing for very fine grained configuration.
151
152 <P>Apache has the capability to serve many different websites
153 simultaneously.  This is called <A HREF="vhosts/">Virtual Hosting</A>.
154 Directives can also be scoped by placing them inside
155 <CODE><A HREF="mod/core.html#virtualhost">&lt;VirtualHost&gt;</A></CODE>
156 sections, so that they will only apply to requests for a particular
157 website.
158
159 <P>Although most directives can be placed in any of these sections,
160 some directives do not make sense in some contexts.  For example,
161 directives controlling process creation can only be placed in the main
162 server context.  To find which directives can be placed in which
163 sections, check the <A
164 HREF="mod/directive-dict.html#Context">Context</A> of the directive.
165 For further information, we provide details on <A
166 HREF="sections.html">How Directory, Location and Files sections
167 work</A>.
168
169 <hr>
170
171 <H2><a name="htaccess">.htaccess Files</a></H2>
172
173 <table border="1"><tr><td valign="top">
174 <strong>Related Directives</strong><br><br>
175 <A HREF="mod/core.html#accessfilename">AccessFileName</A><br>
176 <A HREF="mod/core.html#allowoverride">AllowOverride</A><br>
177 </td></tr></table>
178
179 <P>Apache allows for decentralized management of configuration via
180 special files placed inside the web tree.  The special files are
181 usually called <CODE>.htaccess</CODE>, but any name can be specified
182 in the <A HREF="mod/core.html#accessfilename"><CODE
183 >AccessFileName</CODE></A> directive.  Directives placed in
184 <CODE>.htaccess</CODE> files apply to the directory where you place
185 the file, and all sub-directories.  The <CODE>.htaccess</CODE> files
186 follow the same syntax as the main configuration files.  Since
187 <CODE>.htaccess</CODE> files are read on every request, changes made
188 in these files take immediate effect.
189
190 <P>To find which directives can be placed in <CODE>.htaccess</CODE>
191 files, check the <A HREF="mod/directive-dict.html#Context">Context</A>
192 of the directive.  The server administrator further controls what
193 directives may be placed in <CODE>.htaccess</CODE> files by
194 configuring the <A
195 HREF="mod/core.html#allowoverride"><CODE>AllowOverride</CODE></A>
196 directive in the main configuration files.
197
198 <!--#include virtual="footer.html" -->
199 </BODY>
200 </HTML>