首页 > 代码库 > vim /usr/local/apache2/conf/httpd.conf

vim /usr/local/apache2/conf/httpd.conf

[root@localhost ~]# vim -n /usr/local/apache2/conf/httpd.conf
1 #
2 # This is the main Apache HTTP server configuration file. It contains the
3 # configuration directives that give the server its instructions.
4 # See <URL:http://httpd.apache.org/docs/2.2> for detailed information.
5 # In particular, see
6 # <URL:http://httpd.apache.org/docs/2.2/mod/directives.html>
7 # for a discussion of each configuration directive.
8 #
9 # Do NOT simply read the instructions in here without understanding
10 # what they do. They‘re here only as hints or reminders. If you are unsure
11 # consult the online docs. You have been warned.
12 #
13 # Configuration and logfile names: If the filenames you specify for many
14 # of the server‘s control files begin with "/" (or "drive:/" for Win32), the
15 # server will use that explicit path. If the filenames do *not* begin
16 # with "/", the value of ServerRoot is prepended -- so ‘log/access_log‘
17 # with ServerRoot set to ‘/www‘ will be interpreted by the
18 # server as ‘/www/log/access_log‘, where as ‘/log/access_log‘ will be
19 # interpreted as ‘/log/access_log‘.
20
21 #
22 # ServerRoot: The top of the directory tree under which the server‘s
23 # configuration, error, and log files are kept.
24 #
25 # Do not add a slash at the end of the directory path. If you point
26 # ServerRoot at a non-local disk, be sure to point the LockFile directive
27 # at a local disk. If you wish to share the same ServerRoot for multiple
28 # httpd daemons, you will need to change at least LockFile and PidFile.
29 #
30 ServerRoot "/usr/local/apache2"
31
32 #
33 # Listen: Allows you to bind Apache to specific IP addresses and/or
34 # ports, instead of the default. See also the <VirtualHost>
35 # directive.
36 #
37 # Change this to Listen on specific IP addresses as shown below to
38 # prevent Apache from glomming onto all bound IP addresses.
39 #
40 #Listen 12.34.56.78:80
41 Listen 80
42
43 #
44 # Dynamic Shared Object (DSO) Support
45 #
46 # To be able to use the functionality of a module which was built as a DSO you
47 # have to place corresponding `LoadModule‘ lines at this location so the
48 # directives contained in it are actually available _before_ they are used.
49 # Statically compiled modules (those listed by `httpd -l‘) do not need
50 # to be loaded here.
51 #
52 # Example:
53 # LoadModule foo_module modules/mod_foo.so
54 #
55
56 <IfModule !mpm_netware_module>
57 <IfModule !mpm_winnt_module>
58 #
59 # If you wish httpd to run as a different user or group, you must run
60 # httpd as root initially and it will switch.
61 #
62 # User/Group: The name (or #number) of the user/group to run httpd as.
63 # It is usually good practice to create a dedicated user and group for
64 # running httpd, as with most system services.
65 #
66 User daemon
67 Group daemon
68
69 </IfModule>
70 </IfModule>
71
72 # ‘Main‘ server configuration
73 #
74 # The directives in this section set up the values used by the ‘main‘
75 # server, which responds to any requests that aren‘t handled by a
76 # <VirtualHost> definition. These values also provide defaults for
77 # any <VirtualHost> containers you may define later in the file.
78 #
79 # All of these directives may appear inside <VirtualHost> containers,
80 # in which case these default settings will be overridden for the
81 # virtual host being defined.
82 #
83
84 #
85 # ServerAdmin: Your address, where problems with the server should be
86 # e-mailed. This address appears on some server-generated pages, such
87 # as error documents. e.g. admin@your-domain.com
88 #
89 ServerAdmin you@example.com
90
91 #
92 # ServerName gives the name and port that the server uses to identify itself.
93 # This can often be determined automatically, but we recommend you specify
94 # it explicitly to prevent problems during startup.
95 #
96 # If your host doesn‘t have a registered DNS name, enter its IP address here.
97 #
98 #ServerName www.example.com:80
99 ServerName localhost:80
100
101 #
102 # DocumentRoot: The directory out of which you will serve your
103 # documents. By default, all requests are taken from this directory, but
104 # symbolic links and aliases may be used to point to other locations.
105 #
106 DocumentRoot "/usr/local/apache2/htdocs"
107
108 #
109 # Each directory to which Apache has access can be configured with respect
110 # to which services and features are allowed and/or disabled in that
111 # directory (and its subdirectories).
112 #
113 # First, we configure the "default" to be a very restrictive set of
114 # features.
115 #
116 <Directory />
117 Options FollowSymLinks
118 AllowOverride None
119 Order deny,allow
120 Deny from all
121 </Directory>
122
123 #
124 # Note that from this point forward you must specifically allow
125 # particular features to be enabled - so if something‘s not working as
126 # you might expect, make sure that you have specifically enabled it
127 # below.
128 #
129
130 #
131 # This should be changed to whatever you set DocumentRoot to.
132 #
133 <Directory "/usr/local/apache2/htdocs">
134 #
135 # Possible values for the Options directive are "None", "All",
136 # or any combination of:
137 # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
138 #
139 # Note that "MultiViews" must be named *explicitly* --- "Options All"
140 # doesn‘t give it to you.
141 #
142 # The Options directive is both complicated and important. Please see
143 # http://httpd.apache.org/docs/2.2/mod/core.html#options
144 # for more information.
145 #
146 Options Indexes FollowSymLinks
147
148 #
149 # AllowOverride controls what directives may be placed in .htaccess files.
150 # It can be "All", "None", or any combination of the keywords:
151 # Options FileInfo AuthConfig Limit
152 #
153 AllowOverride None
154
155 #
156 # Controls who can get stuff from this server.
157 #
158 Order allow,deny
159 Allow from all
160
161 </Directory>
162
163 #
164 # DirectoryIndex: sets the file that Apache will serve if a directory
165 # is requested.
166 #
167 <IfModule dir_module>
168 DirectoryIndex index.html
169 </IfModule>
170
171 #
172 # The following lines prevent .htaccess and .htpasswd files from being
173 # viewed by Web clients.
174 #
175 <FilesMatch "^\.ht">
176 Order allow,deny
177 Deny from all
178 Satisfy All
179 </FilesMatch>
180
181 #
182 # ErrorLog: The location of the error log file.
183 # If you do not specify an ErrorLog directive within a <VirtualHost>
184 # container, error messages relating to that virtual host will be
185 # logged here. If you *do* define an error logfile for a <VirtualHost>
186 # container, that host‘s errors will be logged there and not here.
187 #
188 ErrorLog "logs/error_log"
189
190 #
191 # LogLevel: Control the number of messages logged to the error_log.
192 # Possible values include: debug, info, notice, warn, error, crit,
193 # alert, emerg.
194 #
195 LogLevel warn
196
197 <IfModule log_config_module>
198 #
199 # The following directives define some format nicknames for use with
200 # a CustomLog directive (see below).
201 #
202 LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
203 LogFormat "%h %l %u %t \"%r\" %>s %b" common
204
205 <IfModule logio_module>
206 # You need to enable mod_logio.c to use %I and %O
207 LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
208 </IfModule>
209
210 #
211 # The location and format of the access logfile (Common Logfile Format).
212 # If you do not define any access logfiles within a <VirtualHost>
213 # container, they will be logged here. Contrariwise, if you *do*
214 # define per-<VirtualHost> access logfiles, transactions will be
215 # logged therein and *not* in this file.
216 #
217 CustomLog "logs/access_log" common
218
219 #
220 # If you prefer a logfile with access, agent, and referer information
221 # (Combined Logfile Format) you can use the following directive.
222 #
223 #CustomLog "logs/access_log" combined
224 </IfModule>
225
226 <IfModule alias_module>
227 #
228 # Redirect: Allows you to tell clients about documents that used to
229 # exist in your server‘s namespace, but do not anymore. The client
230 # will make a new request for the document at its new location.
231 # Example:
232 # Redirect permanent /foo http://www.example.com/bar
233
234 #
235 # Alias: Maps web paths into filesystem paths and is used to
236 # access content that does not live under the DocumentRoot.
237 # Example:
238 # Alias /webpath /full/filesystem/path
239 #
240 # If you include a trailing / on /webpath then the server will
241 # require it to be present in the URL. You will also likely
242 # need to provide a <Directory> section to allow access to
243 # the filesystem path.
244
245 #
246 # ScriptAlias: This controls which directories contain server scripts.
247 # ScriptAliases are essentially the same as Aliases, except that
248 # documents in the target directory are treated as applications and
249 # run by the server when requested rather than as documents sent to the
250 # client. The same rules about trailing "/" apply to ScriptAlias
251 # directives as to Alias.
252 #
253 ScriptAlias /cgi-bin/ "/usr/local/apache2/cgi-bin/"
254
255 </IfModule>
256
257 <IfModule cgid_module>
258 #
259 # ScriptSock: On threaded servers, designate the path to the UNIX
260 # socket used to communicate with the CGI daemon of mod_cgid.
261 #
262 #Scriptsock logs/cgisock
263 </IfModule>
264
265 #
266 # "/usr/local/apache2/cgi-bin" should be changed to whatever your ScriptAliased
267 # CGI directory exists, if you have that configured.
268 #
269 <Directory "/usr/local/apache2/cgi-bin">
270 AllowOverride None
271 Options None
272 Order allow,deny
273 Allow from all
274 </Directory>
275
276 #
277 # DefaultType: the default MIME type the server will use for a document
278 # if it cannot otherwise determine one, such as from filename extensions.
279 # If your server contains mostly text or HTML documents, "text/plain" is
280 # a good value. If most of your content is binary, such as applications
281 # or images, you may want to use "application/octet-stream" instead to
282 # keep browsers from trying to display binary files as though they are
283 # text.
284 #
285 DefaultType text/plain
286
287 <IfModule mime_module>
288 #
289 # TypesConfig points to the file containing the list of mappings from
290 # filename extension to MIME-type.
291 #
292 TypesConfig conf/mime.types
293
294 #
295 # AddType allows you to add to or override the MIME configuration
296 # file specified in TypesConfig for specific file types.
297 #
298 #AddType application/x-gzip .tgz
299 #
300 # AddEncoding allows you to have certain browsers uncompress
301 # information on the fly. Note: Not all browsers support this.
302 #
303 #AddEncoding x-compress .Z
304 #AddEncoding x-gzip .gz .tgz
305 #
306 # If the AddEncoding directives above are commented-out, then you
307 # probably should define those extensions to indicate media types:
308 #
309 AddType application/x-compress .Z
310 AddType application/x-gzip .gz .tgz
311
312 #
313 # AddHandler allows you to map certain file extensions to "handlers":
314 # actions unrelated to filetype. These can be either built into the server
315 # or added with the Action directive (see below)
316 #
317 # To use CGI scripts outside of ScriptAliased directories:
318 # (You will also need to add "ExecCGI" to the "Options" directive.)
319 #
320 #AddHandler cgi-script .cgi
321
322 # For type maps (negotiated resources):
323 #AddHandler type-map var
324
325 #
326 # Filters allow you to process content before it is sent to the client.
327 #
328 # To parse .shtml files for server-side includes (SSI):
329 # (You will also need to add "Includes" to the "Options" directive.)
330 #
331 #AddType text/html .shtml
332 #AddOutputFilter INCLUDES .shtml
333 </IfModule>
334
335 #
336 # The mod_mime_magic module allows the server to use various hints from the
337 # contents of the file itself to determine its type. The MIMEMagicFile
338 # directive tells the module where the hint definitions are located.
339 #
340 #MIMEMagicFile conf/magic
341
342 #
343 # Customizable error responses come in three flavors:
344 # 1) plain text 2) local redirects 3) external redirects
345 #
346 # Some examples:
347 #ErrorDocument 500 "The server made a boo boo."
348 #ErrorDocument 404 /missing.html
349 #ErrorDocument 404 "/cgi-bin/missing_handler.pl"
350 #ErrorDocument 402 http://www.example.com/subscription_info.html
351 #
352
353 #
354 # MaxRanges: Maximum number of Ranges in a request before
355 # returning the entire resource, or one of the special
356 # values ‘default‘, ‘none‘ or ‘unlimited‘.
357 # Default setting is to accept 200 Ranges.
358 #MaxRanges unlimited
359
360 #
361 # EnableMMAP and EnableSendfile: On systems that support it,
362 # memory-mapping or the sendfile syscall is used to deliver
363 # files. This usually improves server performance, but must
364 # be turned off when serving from networked-mounted
365 # filesystems or if support for these functions is otherwise
366 # broken on your system.
367 #
368 #EnableMMAP off
369 #EnableSendfile off
370
371 # Supplemental configuration
372 #
373 # The configuration files in the conf/extra/ directory can be
374 # included to add extra features or to modify the default configuration of
375 # the server, or you may simply copy their contents here and change as
376 # necessary.
377
378 # Server-pool management (MPM specific)
379 #Include conf/extra/httpd-mpm.conf
380
381 # Multi-language error messages
382 #Include conf/extra/httpd-multilang-errordoc.conf
383
384 # Fancy directory listings
385 #Include conf/extra/httpd-autoindex.conf
386
387 # Language settings
388 #Include conf/extra/httpd-languages.conf
389
390 # User home directories
391 #Include conf/extra/httpd-userdir.conf
392
393 # Real-time info on requests and configuration
394 #Include conf/extra/httpd-info.conf
395
396 # Virtual hosts
397 #Include conf/extra/httpd-vhosts.conf
398
399 # Local access to the Apache HTTP Server Manual
400 #Include conf/extra/httpd-manual.conf
401
402 # Distributed authoring and versioning (WebDAV)
403 #Include conf/extra/httpd-dav.conf
404
405 # Various default settings
406 #Include conf/extra/httpd-default.conf
407
408 # Secure (SSL/TLS) connections
409 #Include conf/extra/httpd-ssl.conf
410 #
411 # Note: The following must must be present to support
412 # starting without SSL on platforms with no /dev/random equivalent
413 # but a statically compiled-in mod_ssl.
414 #
415 <IfModule ssl_module>
416 SSLRandomSeed startup builtin
417 SSLRandomSeed connect builtin
418 </IfModule>

vim /usr/local/apache2/conf/httpd.conf