由 sailing123 在 10-17-2004 15:28 发表:
Redhat9中Apache默认配置文件httpd.conf注解
Rh9中Apache 配置文件httpd.conf默认配置注解,我从《Redhat9网络服务》一书中抄下。
一。 Apache 的三种运行方式:
1. 预生派模式:(Profork)MPM此模块在功能上兼容Apache1.3的运行模型,这种运行方式首先启一个父进程,然后创建一定(可指定)数量的子进程监听客户端的请求,当监听到客户端请求时,子进程就向应请求。父进程始终监控子进程,当没有足够的子进程向客户请求时,父进程就会创建子进程,当存在过多空闲的子进程时,父进程就会终止一些空闲子进程,直到回到最大空闲子进程数量(可指定)之下。
2. 工作者模式:(Worker)MPM 此模块是混合使用进程和线程的运行模型,这种运行方式首先启动一个父进程,然后创建并启动一定(可配置)数量的子进程,每个子进程都创建并启动相同数量的线程,同线程监听客户请求,子进程不监听客户请求,重要的是,父进程始终监控子进程,当没有足够 的空闲线程为客户服务时,父进程就会创建并运行新的子进程,并在子进程中创建与先前子进程相同数量的线程为客户服务,这种方式是牺牲可靠性来换取可展性。
3. 独立子进程:(Perchild)MPM: 这是一种运行在类UNIX系统的上的运行模式,也是混合使用进程和 线程的运行模型,这种运模式与工作者MPM类似,只是每个子进程创建的线程数量可以不一致,每个子进程可创建指定数量的(可配置)线程。当服务器负载增加时,Apache不会创建新子进程,而是在当前子
进程之一上创建新的线程为客户服务。这种运模式具有很高的可扩展性,但却具有最低的可靠性。
Based upon the NCSA server configuration files originally by Rob McCool.
This is the main Apache server configuration file. It contains the
configuration directives that give the server its instructions.
See
1<url: docs-2.0="" http:="" httpd.apache.org=""> for detailed information about
2
3# the directives.
4
5#
6
7# Do NOT simply read the instructions in here without understanding
8
9# what they do. They're here only as hints or reminders. If you are unsure
10
11# consult the online docs. You have been warned.
12
13#
14
15# The configuration directives are grouped into three basic sections:
16
17# 1. Directives that control the operation of the Apache server process as a
18
19# whole (the 'global environment').
20
21# 2. Directives that define the parameters of the 'main' or 'default' server,
22
23# which responds to requests that aren't handled by a virtual host.
24
25# These directives also provide default values for the settings
26
27# of all virtual hosts.
28
29# 3. Settings for virtual hosts, which allow Web requests to be sent to
30
31# different IP addresses or hostnames and have them handled by the
32
33# same Apache server process.
34
35#
36
37# Configuration and logfile names: If the filenames you specify for many
38
39# of the server's control files begin with "/" (or "drive:/" for Win32), the
40
41# server will use that explicit path. If the filenames do *not* begin
42
43# with "/", the value of ServerRoot is prepended -- so "logs/foo.log"
44
45# with ServerRoot set to "/etc/httpd" will be interpreted by the
46
47# server as "/etc/httpd/logs/foo.log".
48
49#
50
51
52
53### Section 1: Global Environment
54
55#
56
57# The directives in this section affect the overall operation of Apache,
58
59# such as the number of concurrent requests it can handle or where it
60
61# can find its configuration files.
62
63#
64
65
66
67#
68
69# Don't give away too much information about all the subcomponents
70
71# we are running. Comment out this line if you don't mind remote sites
72
73# finding out what major optional modules you are running
74
75# 当服务器向应主机头(header)信息时显示Apache的版本号和主机的操作系统
76
77ServerTokens OS
78
79
80
81#
82
83# ServerRoot: The top of the directory tree under which the server's
84
85# configuration, error, and log files are kept.
86
87#
88
89# NOTE! If you intend to place this on an NFS (or otherwise network)
90
91# mounted filesystem then please read the LockFile documentation
92
93# (available at <url: core.html#lockfile="" docs-2.0="" http:="" httpd.apache.org="" mod=""> );
94
95# you will save yourself a lot of trouble.
96
97#
98
99# Do NOT add a slash at the end of the directory path.
100
101#
102
103ServerRoot "/etc/httpd" #设置服务器的根目录
104
105
106
107#
108
109# ScoreBoardFile: File used to store internal server process information.
110
111# If unspecified (the default), the scoreboard will be stored in an
112
113# anonymous shared memory segment, and will be unavailable to third-party
114
115# applications.
116
117# If specified, ensure that no two invocations of Apache share the same
118
119# scoreboard file. The scoreboard file MUST BE STORED ON A LOCAL DISK.
120
121#
122
123#ScoreBoardFile run/httpd.scoreboard
124
125
126
127#
128
129# PidFile: The file in which the server should record its process
130
131# identification number when it starts.
132
133#
134
135PidFile run/httpd.pid #设置运行Apache时使用的pidFile路径
136
137
138
139#
140
141# Timeout: The number of seconds before receives and sends time out.
142
143#
144
145TimeOut 300 #如果300秒没有收到或者送出任何数据就断开该连接
146
147
148
149#
150
151# KeepAlive: Whether or not to allow persistent connections (more than
152
153# one request per connection). Set to "Off" to deactivate.
154
155#
156
157KeepAlive on #使用保持连接的功能,如果为KeepAlive off 则为不使用保持连接的功能,导致客户一次请求只能响应一个文件,建议设为KeepAlive on
158
159
160
161#
162
163# MaxKeepAliveRequests: The maximum number of requests to allow
164
165# during a persistent connection. Set to 0 to allow an unlimited amount.
166
167# We recommend you leave this number high, for maximum performance.
168
169#
170
171MaxKeepAliveRequests 100 #使用保持连接功能时,设置客户一次请求连接能响应的文件数最大上限为100
172
173
174
175#
176
177# KeepAliveTimeout: Number of seconds to wait for the next request from the
178
179# same client on the same connection.
180
181#
182
183KeepAliveTimeout 15 #使用保持连接功能时,如果两个相邻连接时间超过15秒,就断开连接。
184
185
186
187##
188
189## Server-Pool Size Regulation (MPM specific)
190
191##
192
193
194
195# prefork MPM
196
197# StartServers: number of server processes to start
198
199# MinSpareServers: minimum number of server processes which are kept spare
200
201# MaxSpareServers: maximum number of server processes which are kept spare
202
203# MaxClients: maximum number of server processes allowed to start
204
205# MaxRequestsPerChild: maximum number of requests a server process serves
206
207<ifmodule prefork.c=""> #设置使用预生派(Prefork MPM)运行方式的参数,此方式是Redhat默认的方式。
208
209StartServers 8 #设置服务器启动时运行的进程数
210
211MinSpareServers 5 #如果低于5个空闲子进程,就会创建新的子进程为客户提供服务
212
213MaxSpareServers 20 #如果存在高于20个空闲子进程,,就创建逐一删除子进程提高系统性能
214
215MaxClients 150 #限制同一时间连接数不能超过150
216
217MaxRequestsPerChild 1000 #限制每个子进程在结束请求之前能处理的连接请求为1000
218
219</ifmodule>
220
221
222
223# worker MPM
224
225# StartServers: initial number of server processes to start
226
227# MaxClients: maximum number of simultaneous client connections
228
229# MinSpareThreads: minimum number of worker threads which are kept spare
230
231# MaxSpareThreads: maximum number of worker threads which are kept spare
232
233# ThreadsPerChild: constant number of worker threads in each server process
234
235# MaxRequestsPerChild: maximum number of requests a server process serves
236
237<ifmodule worker.c=""> #设置使用工作者模式(worker MPM)运行方式的参数
238
239StartServers 2
240
241MaxClients 150
242
243MinSpareThreads 25
244
245MaxSpareThreads 75
246
247ThreadsPerChild 25
248
249MaxRequestsPerChild 0
250
251</ifmodule>
252
253
254
255# perchild MPM
256
257# NumServers: constant number of server processes
258
259# StartThreads: initial number of worker threads in each server process
260
261# MinSpareThreads: minimum number of worker threads which are kept spare
262
263# MaxSpareThreads: maximum number of worker threads which are kept spare
264
265# MaxThreadsPerChild: maximum number of worker threads in each server process
266
267# MaxRequestsPerChild: maximum number of connections per server process
268
269<ifmodule perchild.c=""> #设置使用独立子进程(Perchild MPM)运行方式的参数
270
271NumServers 5
272
273StartThreads 5
274
275MinSpareThreads 5
276
277MaxSpareThreads 10
278
279MaxThreadsPerChild 20
280
281MaxRequestsPerChild 0
282
283</ifmodule>
284
285
286
287#
288
289# Listen: Allows you to bind Apache to specific IP addresses and/or
290
291# ports, in addition to the default. See also the <virtualhost>
292
293# directive.
294
295#
296
297# Change this to Listen on specific IP addresses as shown below to
298
299# prevent Apache from glomming onto all bound IP addresses (0.0.0.0)
300
301#
302
303#Listen 12.34.56.78:80
304
305Listen *:80 #设置服务器的监听端口
306
307
308
309#
310
311# Load config files from the config directory "/etc/httpd/conf.d".
312
313#
314
315Include conf.d/*.conf #将/etc/httpd/conf.d 目录下所有以conf结尾的配置文件包含进来
316
317
318
319#
320
321# Dynamic Shared Object (DSO) Support
322
323#
324
325# To be able to use the functionality of a module which was built as a DSO you
326
327# have to place corresponding `LoadModule' lines at this location so the
328
329# directives contained in it are actually available _before_ they are used.
330
331# Statically compiled modules (those listed by `httpd -l') do not need
332
333# to be loaded here.
334
335#
336
337# Example:
338
339# LoadModule foo_module modules/mod_foo.so #以下为动态加载模块(DSO)
340
341#
342
343LoadModule access_module modules/mod_access.so
344
345LoadModule auth_module modules/mod_auth.so
346
347LoadModule auth_anon_module modules/mod_auth_anon.so
348
349LoadModule auth_dbm_module modules/mod_auth_dbm.so
350
351LoadModule auth_digest_module modules/mod_auth_digest.so
352
353LoadModule include_module modules/mod_include.so
354
355LoadModule log_config_module modules/mod_log_config.so
356
357LoadModule env_module modules/mod_env.so
358
359LoadModule mime_magic_module modules/mod_mime_magic.so
360
361LoadModule cern_meta_module modules/mod_cern_meta.so
362
363LoadModule expires_module modules/mod_expires.so
364
365LoadModule headers_module modules/mod_headers.so
366
367LoadModule usertrack_module modules/mod_usertrack.so
368
369LoadModule unique_id_module modules/mod_unique_id.so
370
371LoadModule setenvif_module modules/mod_setenvif.so
372
373LoadModule mime_module modules/mod_mime.so
374
375LoadModule dav_module modules/mod_dav.so
376
377LoadModule status_module modules/mod_status.so
378
379LoadModule autoindex_module modules/mod_autoindex.so
380
381LoadModule asis_module modules/mod_asis.so
382
383LoadModule info_module modules/mod_info.so
384
385LoadModule dav_fs_module modules/mod_dav_fs.so
386
387LoadModule vhost_alias_module modules/mod_vhost_alias.so
388
389LoadModule negotiation_module modules/mod_negotiation.so
390
391LoadModule dir_module modules/mod_dir.so
392
393LoadModule imap_module modules/mod_imap.so
394
395LoadModule actions_module modules/mod_actions.so
396
397LoadModule speling_module modules/mod_speling.so
398
399LoadModule userdir_module modules/mod_userdir.so
400
401LoadModule alias_module modules/mod_alias.so
402
403LoadModule rewrite_module modules/mod_rewrite.so
404
405LoadModule proxy_module modules/mod_proxy.so
406
407LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
408
409LoadModule proxy_http_module modules/mod_proxy_http.so
410
411LoadModule proxy_connect_module modules/mod_proxy_connect.so
412
413
414
415<ifmodule prefork.c=""> #当使用内置模块prefork.c时动态加载cgi_module
416
417LoadModule cgi_module modules/mod_cgi.so
418
419</ifmodule>
420<ifmodule worker.c=""> #当使用内置模块worker.c时动态加载cgi_module
421
422LoadModule cgid_module modules/mod_cgid.so
423
424</ifmodule>
425
426
427
428#
429
430# ExtendedStatus controls whether Apache will generate "full" status
431
432# information (ExtendedStatus On) or just basic information (ExtendedStatus
433
434# Off) when the "server-status" handler is called. The default is Off.
435
436#
437
438#ExtendedStatus On
439
440
441
442### Section 2: 'Main' server configuration
443
444#
445
446# The directives in this section set up the values used by the 'main'
447
448# server, which responds to any requests that aren't handled by a
449
450# <virtualhost> definition. These values also provide defaults for
451
452# any <virtualhost> containers you may define later in the file.
453
454#
455
456# All of these directives may appear inside <virtualhost> containers,
457
458# in which case these default settings will be overridden for the
459
460# virtual host being defined.
461
462#
463
464
465
466#
467
468# If you wish httpd to run as a different user or group, you must run
469
470# httpd as root initially and it will switch.
471
472#
473
474# User/Group: The name (or #number) of the user/group to run httpd as.
475
476# . On SCO (ODT 3) use "User nouser" and "Group nogroup".
477
478# . On HPUX you may not be able to use shared memory as nobody, and the
479
480# suggested workaround is to create a user www and use that user.
481
482# NOTE that some kernels refuse to setgid(Group) or semctl(IPC_SET)
483
484# when the value of (unsigned)Group is above 60000;
485
486# don't use Group #-1 on these systems!
487
488#
489
490User apache #设置运行Apache服务器的用户和组
491
492Group apache
493
494
495
496#
497
498# ServerAdmin: Your address, where problems with the server should be
499
500# e-mailed. This address appears on some server-generated pages, such
501
502# as error documents. e.g. [email protected]
503
504#
505
506ServerAdmin root@localhost #设置Apache 服务器管理员的E_mail地址
507
508
509
510#
511
512# ServerName gives the name and port that the server uses to identify itself.
513
514# This can often be determined automatically, but we recommend you specify
515
516# it explicitly to prevent problems during startup.
517
518#
519
520# If this is not set to valid DNS name for your host, server-generated
521
522# redirections will not work. See also the UseCanonicalName directive.
523
524#
525
526# If your host doesn't have a registered DNS name, enter its IP address here.
527
528# You will have to access it by its address anyway, and this will make
529
530# redirections work in a sensible way.
531
532#
533
534#ServerName new.host.name:80 #关闭此选项,当Apache服务器需要指向本身的连接时使用
535
536#如打开此选项,则使用 new.host.name:80作为主机名
537
538#
539
540# UseCanonicalName: Determines how Apache constructs self-referencing
541
542# URLs and the SERVER_NAME and SERVER_PORT variables.
543
544# When set "Off", Apache will use the Hostname and Port supplied
545
546# by the client. When set "On", Apache will use the value of the
547
548# ServerName directive.
549
550#
551
552UseCanonicalName off
553
554
555
556#
557
558# DocumentRoot: The directory out of which you will serve your
559
560# documents. By default, all requests are taken from this directory, but
561
562# symbolic links and aliases may be used to point to other locations.
563
564#
565
566DocumentRoot "/var/www/html" #设置根文档的路径
567
568#
569
570# Each directory to which Apache has access can be configured with respect
571
572# to which services and features are allowed and/or disabled in that
573
574# directory (and its subdirectories).
575
576#
577
578# First, we configure the "default" to be a very restrictive set of
579
580# features.
581
582#
583
584<directory></directory> #设置Apache服务器的访问权限
585
586Options FollowSymLinks #允许符号链接跟随,访问不在本目录的文件
587
588AllowOverride None #禁止读取.htaccess配置文件的内容
589
590
591
592
593
594#
595
596# Note that from this point forward you must specifically allow
597
598# particular features to be enabled - so if something's not working as
599
600# you might expect, make sure that you have specifically enabled it
601
602# below.
603
604#
605
606
607
608#
609
610# This should be changed to whatever you set DocumentRoot to.
611
612#
613
614<directory "="" html"="" var="" www=""> #设置文档目录的访问权限
615
616
617
618#
619
620# Possible values for the Options directive are "None", "All",
621
622# or any combination of:
623
624# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI Multiviews #当在目录中找不到DirectoryIndex列表中指定的文件
625
626# #就生成当前目录的文件列表
627
628# Note that "MultiViews" must be named *explicitly* --- "Options All"
629
630# doesn't give it to you.
631
632#
633
634# The Options directive is both complicated and important. Please see
635
636# http://httpd.apache.org/docs-2.0/mod/core.html#options
637
638# for more information.
639
640#
641
642Options Indexes FollowSymLinks #允许符链接跟随,访问不在本目录的文件
643
644
645
646#
647
648# AllowOverride controls what directives may be placed in .htaccess files.
649
650# It can be "All", "None", or any combination of the keywords:
651
652# Options FileInfo AuthConfig Limit
653
654#
655
656AllowOverride None #禁止读取.htaccess配置文件的内容
657
658
659
660#
661
662# Controls who can get stuff from this server.
663
664#
665
666order allow,deny #先执行(Allow)允许访问规则,再执行(Deny)拒绝访问规则
667
668allow from all #设置Allow(允许)访问规则,允许所有连接
669
670allow from all
671
672
673
674</directory>
675
676
677
678#
679
680# Disable autoindex for the root directory, and present a
681
682# default Welcome page if no other index page is present.
683
684#
685
686<locationmatch "^="" $=""> #对Apache服务器根的访问不生成目录列表,同时指定错误输出页面
687
688Options -Indexes
689
690ErrorDocument 403 /error/noindex.html
691
692</locationmatch>
693
694
695
696#
697
698# UserDir: The name of the directory that is appended onto a user's home
699
700# directory if a ~user request is received.
701
702#
703
704# The path to the end user account 'public_html' directory must be
705
706# accessible to the webserver userid. This usually means that ~userid
707
708# must have permissions of 711, ~userid/public_html must have permissions
709
710# of 755, and documents contained therein must be world-readable.
711
712# Otherwise, the client will only receive a "403 Forbidden" message.
713
714#
715
716# See also: http://httpd.apache.org/docs/misc/FAQ.html#forbidden
717
718#
719
720<ifmodule mod_userdir.c="">
721
722#
723
724# UserDir is disabled by default since it can confirm the presence
725
726# of a username on the system (depending on home directory
727
728# permissions).
729
730#
731
732UserDir disable #不允许每用户的服务器设置
733
734
735
736#
737
738# To enable requests to /~user/ to serve the user's public_html
739
740# directory, remove the "UserDir disable" line above, and uncomment
741
742# the following line instead:
743
744#
745
746#UserDir public_html
747
748
749
750</ifmodule>
751
752
753
754#
755
756# Control access to UserDir directories. The following is an example
757
758# for a site where these directories are restricted to read-only.
759
760#
761
762#<directory *="" home="" public_html="">
763
764# AllowOverride FileInfo AuthConfig Limit
765
766# Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
767
768# <limit get="" options="" post="">
769
770# Order allow,deny
771
772# Allow from all
773
774# </limit>
775
776# <limitexcept get="" options="" post="">
777
778# Order deny,allow
779
780# Deny from all
781
782# </limitexcept>
783
784#</directory>
785
786
787
788#
789
790# DirectoryIndex: sets the file that Apache will serve if a directory
791
792# is requested.
793
794#
795
796# The index.html.var file (a type-map) is used to deliver content-
797
798# negotiated documents. The MultiViews Option can be used for the
799
800# same purpose, but it is much slower.
801
802#
803
804DirectoryIndex index.htm index.html index.php #当访问服务器时依次查找index.htm index.html index.php
805
806
807
808#
809
810# AccessFileName: The name of the file to look for in each directory
811
812# for access control information. See also the AllowOverride directive.
813
814#
815
816AccessFileName .htaccess #指定保护目录配置文件的名称
817
818
819
820#
821
822# The following lines prevent .htaccess and .htpasswd files from being
823
824# viewed by Web clients.
825
826#
827
828<files "^\\.ht"="" ~=""> #拒绝访问以.ht开头的文件,即保证.htaccess文件不被访问
829
830Order allow,deny
831
832Deny from all
833
834</files>
835
836
837
838#
839
840# TypesConfig describes where the mime.types file (or equivalent) is
841
842# to be found.
843
844#
845
846TypesConfig /etc/mime.types #指定负责处理MIME对应格式的配置文件的存放位置
847
848
849
850#
851
852# DefaultType is the default MIME type the server will use for a document
853
854# if it cannot otherwise determine one, such as from filename extensions.
855
856# If your server contains mostly text or HTML documents, "text/plain" is
857
858# a good value. If most of your content is binary, such as applications
859
860# or images, you may want to use "application/octet-stream" instead to
861
862# keep browsers from trying to display binary files as though they are
863
864# text.
865
866#
867
868DefaultType text/plain #指定默认的MIME文件类型为纯文本或HTML文件
869
870
871
872#
873
874# The mod_mime_magic module allows the server to use various hints from the
875
876# contents of the file itself to determine its type. The MIMEMagicFile
877
878# directive tells the module where the hint definitions are located.
879
880#
881
882<ifmodule mod_mime_magic.c=""> #当mod_mime_magic.c模块加载时,指定Magic信息码配置文件的存放位置
883
884# MIMEMagicFile /usr/share/magic.mime
885
886MIMEMagicFile conf/magic
887
888</ifmodule>
889
890
891
892#
893
894# HostnameLookups: Log the names of clients or just their IP addresses
895
896# e.g., www.apache.org (on) or 204.62.129.132 (off).
897
898# The default is off because it'd be overall better for the net if people
899
900# had to knowingly turn this feature on, since enabling it means that
901
902# each client request will result in AT LEAST one lookup request to the
903
904# nameserver.
905
906#
907
908HostNameLookups off # 只记录连接Apache服务器的IP地址,而不记录主机名
909
910
911
912#
913
914# ErrorLog: The location of the error log file.
915
916# If you do not specify an ErrorLog directive within a <virtualhost>
917
918# container, error messages relating to that virtual host will be
919
920# logged here. If you *do* define an error logfile for a <virtualhost>
921
922# container, that host's errors will be logged there and not here.
923
924#
925
926ErrorLog logs/error_log #指定错误日志的存放位置
927
928
929
930#
931
932# LogLevel: Control the number of messages logged to the error_log.
933
934# Possible values include: debug, info, notice, warn, error, crit,
935
936# alert, emerg.
937
938#
939
940LogLevel warn #指定记录的错误信息的详细等级为warm 级别
941
942
943
944#
945
946# The following directives define some format nicknames for use with
947
948# a CustomLog directive (see below).
949
950# 定义4种日志记录格式
951
952LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
953
954LogFormat "%h %l %u %t \"%r\" %>s %b" common
955
956LogFormat "%{Referer}i -> %U" referer
957
958LogFormat "%{User-agent}i" agent
959
960
961
962#
963
964# The location and format of the access logfile (Common Logfile Format).
965
966# If you do not define any access logfiles within a <virtualhost>
967
968# container, they will be logged here. Contrariwise, if you *do*
969
970# define per-<virtualhost> access logfiles, transactions will be
971
972# logged therein and *not* in this file.
973
974#
975
976# CustomLog logs/access_log common
977
978CustomLog logs/access_log combined #指定访问日志的记录格式为combined(混合型),并指定访问日志的存放位置
979
980
981
982#
983
984# If you would like to have agent and referer logfiles, uncomment the
985
986# following directives.
987
988#
989
990#CustomLog logs/referer_log referer
991
992#CustomLog logs/agent_log agent
993
994
995
996#
997
998# If you prefer a single logfile with access, agent, and referer information
999
1000# (Combined Logfile Format) you can use the following directive.
1001
1002#
1003
1004#CustomLog logs/access_log combined
1005
1006
1007
1008#
1009
1010# Optionally add a line containing the server version and virtual host
1011
1012# name to server-generated pages (error documents, FTP directory listings,
1013
1014# mod_status and mod_info output etc., but not CGI generated documents).
1015
1016# Set to "EMail" to also include a mailto: link to the ServerAdmin.
1017
1018# Set to one of: On | Off | EMail
1019
1020#
1021
1022ServerSignature On #设置Apache自己产生的页面中使用Apache服务器版本的签名
1023
1024
1025
1026#
1027
1028# Aliases: Add here as many aliases as you need (with no limit). The format is
1029
1030# Alias fakename realname
1031
1032#
1033
1034# Note that if you include a trailing / on fakename then the server will
1035
1036# require it to be present in the URL. So "/icons" isn't aliased in this
1037
1038# example, only "/icons/". If the fakename is slash-terminated, then the
1039
1040# realname must also be slash terminated, and if the fakename omits the
1041
1042# trailing slash, the realname must also omit it.
1043
1044#
1045
1046# We include the /icons/ alias for FancyIndexed directory listings. If you
1047
1048# do not use FancyIndexing, you may comment this out.
1049
1050#
1051
1052Alias /icons/ "/var/www/icons/" #设置内容协商目录的访问别名
1053
1054
1055
1056<directory "="" icons"="" var="" www=""> #设置/var/www/icons目录的访问权限
1057
1058Options Indexes MultiViews #MultiViews: 使用内容协商功能决定被发送的网页性质
1059
1060AllowOverride None
1061
1062Order allow,deny
1063
1064Allow from all
1065
1066</directory>
1067
1068
1069
1070#
1071
1072# This should be changed to the ServerRoot/manual/. The alias provides
1073
1074# the manual, even if you choose to move your DocumentRoot. You may comment
1075
1076# this out if you do not care for the documentation.
1077
1078#
1079
1080Alias /manual "/var/www/manual" #设置Apache手册的访问别名
1081
1082
1083
1084<directory "="" manual"="" var="" www=""> #设置/var/www/manual 目录的访问权限
1085
1086Options Indexes FollowSymLinks MultiViews
1087
1088AllowOverride None
1089
1090Order allow,deny
1091
1092Allow from all
1093
1094</directory>
1095<ifmodule mod_dav_fs.c=""> #指定DAV加锁数据库文件的存放位置
1096
1097# Location of the WebDAV lock database.
1098
1099DAVLockDB /var/lib/dav/lockdb
1100
1101</ifmodule>
1102
1103
1104
1105#
1106
1107# ScriptAlias: This controls which directories contain server scripts.
1108
1109# ScriptAliases are essentially the same as Aliases, except that
1110
1111# documents in the realname directory are treated as applications and
1112
1113# run by the server when requested rather than as documents sent to the client.
1114
1115# The same rules about trailing "/" apply to ScriptAlias directives as to
1116
1117# Alias.
1118
1119#
1120
1121ScriptAlias /cgi-bin/ "/var/www/cgi-bin/" #设置CGI目录的访问别名
1122
1123
1124
1125<ifmodule mod_cgid.c=""> #由于Redhat9中不使用worker MPM运行方式,所以不加载mod_cigd.c模块
1126
1127#
1128
1129# Additional to mod_cgid.c settings, mod_cgid has Scriptsock <path>
1130
1131# for setting UNIX socket for communicating with cgid.
1132
1133#
1134
1135Scriptsock run/httpd.cgid
1136
1137</path></ifmodule>
1138
1139
1140
1141#
1142
1143# "/var/www/cgi-bin" should be changed to whatever your ScriptAliased
1144
1145# CGI directory exists, if you have that configured.
1146
1147#
1148
1149<directory "="" cgi-bin"="" var="" www=""> #设置CGI目录的访问权限
1150
1151AllowOverride None
1152
1153Options None
1154
1155Order allow,deny
1156
1157Allow from all
1158
1159</directory>
1160
1161
1162
1163#
1164
1165# Redirect allows you to tell clients about documents which used to exist in
1166
1167# your server's namespace, but do not anymore. This allows you to tell the
1168
1169# clients where to look for the relocated document.
1170
1171# Example:
1172
1173# Redirect permanent /foo http://www.andsky.com/bar
1174
1175
1176
1177#
1178
1179# Directives controlling the display of server-generated directory listings.
1180
1181#
1182
1183
1184
1185#
1186
1187# FancyIndexing is whether you want fancy directory indexing or standard.
1188
1189# VersionSort is whether files containing version numbers should be
1190
1191# compared in the natural way, so that `apache-1.3.9.tar' is placed before
1192
1193# `apache-1.3.12.tar'.
1194
1195# #FancyIndexing:对每种类型的文件前加上一个小图标以示区别
1196
1197IndexOptions FancyIndexing VersionSort NameWidth=* #VersionSort:对同一软件的多个版本进行排序
1198
1199#NameWidth=*:文件名字段自动适应当前目录下最长文件名
1200
1201#
1202
1203# AddIcon* directives tell the server which icon to show for different
1204
1205# files or filename extensions. These are only displayed for
1206
1207# FancyIndexed directories. #当使用FancyIndexing VersionSort 之后,配置下在面的参数
1208
1209# #用于告知服务器在碰到不同的文件类型或扩展名时采用MIME编码格式
1210
1211AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip #辨别文件并显示对应的图标
1212
1213
1214
1215AddIconByType (TXT,/icons/text.gif) text/*
1216
1217AddIconByType (IMG,/icons/image2.gif) image/*
1218
1219AddIconByType (SND,/icons/sound2.gif) audio/*
1220
1221AddIconByType (VID,/icons/movie.gif) video/*
1222
1223#当使用FancyIndexing VersionSort 之后,配置下在面的参数
1224
1225AddIcon /icons/binary.gif .bin .exe #用于告知服务器在碰到不同的文件类型或扩展名时采用指定的格式
1226
1227AddIcon /icons/binhex.gif .hqx #并显示对应的图标
1228
1229AddIcon /icons/tar.gif .tar
1230
1231AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv
1232
1233AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip
1234
1235AddIcon /icons/a.gif .ps .ai .eps
1236
1237AddIcon /icons/layout.gif .html .shtml .htm .pdf
1238
1239AddIcon /icons/text.gif .txt
1240
1241AddIcon /icons/c.gif .c
1242
1243AddIcon /icons/p.gif .pl .py
1244
1245AddIcon /icons/f.gif .for
1246
1247AddIcon /icons/dvi.gif .dvi
1248
1249AddIcon /icons/uuencoded.gif .uu
1250
1251AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl
1252
1253AddIcon /icons/tex.gif .tex
1254
1255AddIcon /icons/bomb.gif core
1256
1257
1258
1259AddIcon /icons/back.gif ..
1260
1261AddIcon /icons/hand.right.gif README
1262
1263AddIcon /icons/folder.gif ^^DIRECTORY^^
1264
1265AddIcon /icons/blank.gif ^^BLANKICON^^
1266
1267
1268
1269#
1270
1271# DefaultIcon is which icon to show for files which do not have an icon
1272
1273# explicitly set.
1274
1275# #当使用FancyIndexing VersionSort 之后,且无法识别文件类型时,
1276
1277DefaultIcon /icons/unknown.gif #显示此处定义的图标
1278
1279
1280
1281#
1282
1283# AddDescription allows you to place a short description after a file in
1284
1285# server-generated indexes. These are only displayed for FancyIndexed
1286
1287# directories.
1288
1289# Format: AddDescription "description" filename
1290
1291#
1292
1293#AddDescription "GZIP compressed document" .gz
1294
1295#AddDescription "tar archive" .tar
1296
1297#AddDescription "GZIP compressed tar archive" .tgz
1298
1299
1300
1301#
1302
1303# ReadmeName is the name of the README file the server will look for by
1304
1305# default, and append to directory listings.
1306
1307#
1308
1309# HeaderName is the name of a file which should be prepended to
1310
1311# directory indexes.
1312
1313ReadmeName README.html #当服务器自动列出目录列表时,在所生成的页面之后显示README.html的内容
1314
1315HeaderName HEADER.html #当服务器自动列出目录列表时,在所生成的页面之前显示HEADER.html的内容
1316
1317
1318
1319#
1320
1321# IndexIgnore is a set of filenames which directory indexing should ignore
1322
1323# and not include in the listing. Shell-style wildcarding is permitted.
1324
1325#
1326
1327IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t
1328
1329
1330
1331#
1332
1333# AddEncoding allows you to have certain browsers (Mosaic/X 2.1+) uncompress
1334
1335# information on the fly. Note: Not all browsers support this.
1336
1337# Despite the name similarity, the following Add* directives have nothing
1338
1339# to do with the FancyIndexing customization directives above.
1340
1341#
1342
1343AddEncoding x-compress Z #设置在线浏览器可以实时解压.Z .gz .tgz类型文件,但并非所有浏览器都支持
1344
1345AddEncoding x-gzip gz tgz
1346
1347
1348
1349#
1350
1351# DefaultLanguage and AddLanguage allows you to specify the language of
1352
1353# a document. You can then use content negotiation to give a browser a
1354
1355# file in a language the user can understand.
1356
1357#
1358
1359# Specify a default language. This means that all data
1360
1361# going out without a specific language tag (see below) will
1362
1363# be marked with this one. You probably do NOT want to set
1364
1365# this unless you are sure it is correct for all cases.
1366
1367#
1368
1369# * It is generally better to not mark a page as
1370
1371# * being a certain language than marking it with the wrong
1372
1373# * language!
1374
1375#
1376
1377# DefaultLanguage nl
1378
1379#
1380
1381# Note 1: The suffix does not have to be the same as the language
1382
1383# keyword --- those with documents in Polish (whose net-standard
1384
1385# language code is pl) may wish to use "AddLanguage pl .po" to
1386
1387# avoid the ambiguity with the common suffix for perl scripts.
1388
1389#
1390
1391# Note 2: The example entries below illustrate that in some cases
1392
1393# the two character 'Language' abbreviation is not identical to
1394
1395# the two character 'Country' code for its country,
1396
1397# E.g. 'Danmark/dk' versus 'Danish/da'.
1398
1399#
1400
1401# Note 3: In the case of 'ltz' we violate the RFC by using a three char
1402
1403# specifier. There is 'work in progress' to fix this and get
1404
1405# the reference data for rfc1766 cleaned up.
1406
1407#
1408
1409# Danish (da) - Dutch (nl) - English (en) - Estonian (et)
1410
1411# French (fr) - German (de) - Greek-Modern (el)
1412
1413# Italian (it) - Norwegian (no) - Norwegian Nynorsk (nn) - Korean (kr)
1414
1415# Portugese (pt) - Luxembourgeois* (ltz)
1416
1417# Spanish (es) - Swedish (sv) - Catalan (ca) - Czech(cz)
1418
1419# Polish (pl) - Brazilian Portuguese (pt-br) - Japanese (ja)
1420
1421# Russian (ru) - Croatian (hr)
1422
1423#
1424
1425AddLanguage da .dk #设置网页内容语言种类,(浏览器要启用内容协商),对于中文网页,此项无实际意义
1426
1427AddLanguage nl .nl
1428
1429AddLanguage en .en
1430
1431AddLanguage et .et
1432
1433AddLanguage fr .fr
1434
1435AddLanguage de .de
1436
1437AddLanguage he .he
1438
1439AddLanguage el .el
1440
1441AddLanguage it .it
1442
1443AddLanguage ja .ja
1444
1445AddLanguage pl .po
1446
1447AddLanguage kr .kr
1448
1449AddLanguage pt .pt
1450
1451AddLanguage nn .nn
1452
1453AddLanguage no .no
1454
1455AddLanguage pt-br .pt-br
1456
1457AddLanguage ltz .ltz
1458
1459AddLanguage ca .ca
1460
1461AddLanguage es .es
1462
1463AddLanguage sv .se
1464
1465AddLanguage cz .cz
1466
1467AddLanguage ru .ru
1468
1469AddLanguage tw .tw
1470
1471AddLanguage zh-tw .tw
1472
1473AddLanguage hr .hr
1474
1475
1476
1477#
1478
1479# LanguagePriority allows you to give precedence to some languages
1480
1481# in case of a tie during content negotiation.
1482
1483#
1484
1485# Just list the languages in decreasing order of preference. We have
1486
1487# more or less alphabetized them here. You probably want to change this.
1488
1489#
1490
1491LanguagePriority en da nl et fr de el it ja kr no pl pt pt-br ltz ca es sv tw #当启用内容协商时,设置语言的先后顺序
1492
1493
1494
1495#
1496
1497# ForceLanguagePriority allows you to serve a result page rather than
1498
1499# MULTIPLE CHOICES (Prefer) [in case of a tie] or NOT ACCEPTABLE (Fallback)
1500
1501# [in case no accepted languages matched the available variants]
1502
1503#
1504
1505ForceLanguagePriority Prefer Fallback #Prefer:当有多种语言可以匹配时,使用LanguagePriority 列表的第一项
1506
1507#Fallback:当没有语言可以匹配时,使用LanguagePriority 列表的第一项
1508
1509#
1510
1511# Specify a default charset for all pages sent out. This is
1512
1513# always a good idea and opens the door for future internationalisation
1514
1515# of your web site, should you ever want it. Specifying</virtualhost></virtualhost></virtualhost></virtualhost></virtualhost></virtualhost></virtualhost></virtualhost></url:></url:>