一、Apache的安装
首先使用下面的命令来查看系统是否已经安装了Apache
可看到已经安装好了。
另外也可以在终端窗口中执行来查看httpd程序是否在执行。
下面介绍Apache服务器文件和目录
WEB站点目录                                                                           描述
/var/www                           Apache WEB站点文件的目录
/var/www/html                 WEB站点的WEB文件
/var/www/cgi-bin             CGI程序文件
/var/www/html/manual   Apache WEB服务器手册
/var/www/htmll/usage    webalizer程序文件
 
配置文件
/etc/httpd/conf     基于目录的配置文件,.htaccess文件包含对它所在目录中文件的访问控制指令
/etc/httpd/conf/httpd.conf   Apache WEB服务器配置文件目录
/etc/httpd/conf/srm.conf       主要的Apache WEB服务器配置文件
/etc/httpd/conf/access.conf   用来处理文档规范,配置文件类型昨未知的老式配置文件
 
启动脚本
/etc/rc.d/init.d/httpd        WEB服务器守护进程的启动脚本
/etc/rc.d/rc3.d/S85httpd   将运行级目录(/etc/rc3.d)连接到目录/etc/rc.d/init.d中的启动脚本
 
应用文件
/usr/sbin      Apache WEB服务器程序文件和应用程序的位置
/usr/doc/   Apache WEB服务器文档
/var/log/http  Apache 日志文件的位置
 
二、启动和运行Apache服务器
其中一种是:
另处一种是:
httpd除了start\stop命令之外,还有reload,condrestant,status命令,共6种状态
 
三.启动系统时自动运行Apache
若想让系统自动执行Apache,只需执行setup命令,进行Text Mode Setup Utility界面,选中System services中的:httpd服务"即可.
当然,还有一种更方便的图形化方法.选择"应用程序/系统设置/服务器设置/服务/
四.httpd.conf文件详细和配置
旧版中的srm.conf与access.conf文件的内容都被整合到httpd.conf文件中了.
 
#
# 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 <URL:[url]http://httpd.apache.org/docs-2.0/[/url]> for detailed information about
# the directives.
#
#
#这是Apache服务器主要配置文件。
#它包含服务器的影响服务器运行的配置指令。
#参见以取得关于这些指令的详细信息
#
# Do NOT simply read the instructions in here without understanding
# what they do.  They're here only as hints or reminders.  If you are unsure
# consult the online docs. You have been warned. 
#
#不要只是简单的阅读这些指令信息而不去理解它。
#这里只是做了简单的说明,如果你没有参考在线文件,你就会被警告。
#
# The configuration directives are grouped into three basic sections:
#  1. Directives that control the operation of the Apache server process as a
#     whole (the 'global environment').
#  2. Directives that define the parameters of the 'main' or 'default' server,
#     which responds to requests that aren't handled by a virtual host.
#     These directives also provide default values for the settings
#     of all virtual hosts.
#  3. Settings for virtual hosts, which allow Web requests to be sent to
#     different IP addresses or hostnames and have them handled by the
#     same Apache server process.
#
#这些配置指令被分为下面三个部分:
#1. 控制整个Apache服务器行为的部分(即全局环境变量)
#2. 定义主要或者默认服务参数的指令,也为所有虚拟主机提供默认的设置参数
#3. 虚拟主机的设置参数
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path.  If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so "logs/foo.log"
# with ServerRoot set to "/etc/httpd" will be interpreted by the
# server as "/etc/httpd/logs/foo.log".
#
#配置和日志文件名:如果你指定的文件名以“/”开始(win32下以“dirver:/”),
#服务器将使用绝对路径,如果文件名不是以“/”开始的,那么它将把ServerRoot
#的值附加在文件名的前面,例如,对“logs/foo.log",如果ServerRoot的值
#为“/etc/httpd”,则该文件应为“/etc/httpd/logs/foo.log”
#
### Section 1: Global Environment
#
# The directives in this section affect the overall operation of Apache,
# such as the number of concurrent requests it can handle or where it
# can find its configuration files.
#
##第一区:全局环境参数
#
#这里设置的参数将影响整个Apache服务器的行为;
#例如Apache能够处理的并发请求的数量等。
#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
#ServerRoot:指出服务器保存其配置、出错和日志文件等的根目录。
#
# NOTE!  If you intend to place this on an NFS (or otherwise network)
# mounted filesystem then please read the LockFile documentation
# (available at <URL:[url]http://httpd.apache.org/docs-2.0/mod/mpm_common.html#lockfile[/url]>);
# you will save yourself a lot of trouble.
#
# Do NOT add a slash at the end of the directory path.
#
ServerRoot "/etc/httpd"
#注意!如果你想要将它指定为NFS或其它网络上的位置,
#请一定要去阅读与LockFile有关的文档(可能在
#)。
#这将会使你自己也能解决很多问题。
#
#路径的结尾不要添加斜线。
#
ServerRoot "/etc/httpd"
# PidFile: The file in which the server should record its process
# identification number when it starts.
#
PidFile run/httpd.pid
#
#串行访问的锁文件必须保存在本地磁盘上
#
#PidFile:记录服务器启动进程号的文件。
#
# Timeout: The number of seconds before receives and sends time out.
#
Timeout 120
#Timeout:接收和发送前超时秒数
#
Timeout 120
#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive Off
#
#KeepAlive:是否允许稳固的连接(每个连接有多个请求),
#设为"Off"则停用。
#
KeepAlive Off
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100
#
#MaxKeepAliveRequests:在稳固连接期间允许的最大请求数,
#设为0表示无限制接入。
#我们推荐你将其设为一个较大的值,以便提高性能
MaxKeepAliveRequests 100
#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 15
#
#KeepAliveTimeout:在同一个连接上从同一台客户上接收请求的秒数
#
KeepAliveTimeout 15

##
## Server-Pool Size Regulation (MPM specific)
##
##
##Server-Pool大小设定(针对MPM的)
##
# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# ServerLimit: maximum value for MaxClients for the lifetime of the server
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule prefork.c>
StartServers       8
MinSpareServers    5
MaxSpareServers   20
ServerLimit      256
MaxClients       256
MaxRequestsPerChild  4000
</IfModule>
# prefork MPM
# StartServers:启动时服务器启动的进程数
# MinSpareServers:保有的备用进程的最小数目
# MaxSpareServers:保有的备用进程的最大数目
# MaxClients:服务器允许启动的最大进程数
# MaxRequestsPerChild:一个服务进程允许的最大请求数
StartServers 8
MinSpareServers 5
MaxSpareServers 20
MaxClients 256
MaxRequestPerChild 4000
# worker MPM
# StartServers: initial number of server processes to start
# MaxClients: maximum number of simultaneous client connections
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule worker.c>
StartServers         2
MaxClients         150
MinSpareThreads     25
MaxSpareThreads     75
ThreadsPerChild     25
MaxRequestsPerChild  0
</IfModule>
# worker MPM
# StartServers:服务器启动时的服务进程数目
# MaxClients:允许同时连接的最大用户数目
# MinSpareThreads:保有的最小工作线程数目
# MaxSpareThreads:允许保有的最大工作线程数目
# ThreadsPerChild:每个服务进程中的工作线程常数
# MaxRequestsPerChild:服务进程中允许的最大请求数目
StartServers 2
MaxClients 150
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 0
#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, in addition to the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses (0.0.0.0)
#
#Listen 12.34.56.78:80
Listen 80
#
# Listen:允许你绑定Apache服务到指定的IP地址和端口上,以取代默认值
# 参见指令
# 使用如下命令使Apache只在指定的IP地址上监听,
# 以防止它在IP地址0.0.0.0上监听
#
# Listen 12.34.56.78:80
Listen 80
#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.
#
# Example:
# LoadModule foo_module modules/mod_foo.so
#

#
# 动态共享支持(DSO)
#
# 为了能够使用那些以DSO模式编译的模块中的函数,你必须有相应的“LoadModule”行,
# 因此,在这里包含了这些指令,以便能在使用它之前激活。
# 那些静态编译的模块不需要在这里列出 (即以“httpd -l”列出的模块)
#
# 示例:
# LoadModule foo_module modules/mod_foo.so
#
#
LoadModule access_module modules/mod_access.so
LoadModule auth_module modules/mod_auth.so
LoadModule auth_anon_module modules/mod_auth_anon.so
LoadModule auth_dbm_module modules/mod_auth_dbm.so
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule ldap_module modules/mod_ldap.so
LoadModule auth_ldap_module modules/mod_auth_ldap.so
LoadModule include_module modules/mod_include.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule env_module modules/mod_env.so
LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule cern_meta_module modules/mod_cern_meta.so
LoadModule expires_module modules/mod_expires.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule headers_module modules/mod_headers.so
LoadModule usertrack_module modules/mod_usertrack.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule mime_module modules/mod_mime.so
LoadModule dav_module modules/mod_dav.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule asis_module modules/mod_asis.so
LoadModule info_module modules/mod_info.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule dir_module modules/mod_dir.so
LoadModule imap_module modules/mod_imap.so
LoadModule actions_module modules/mod_actions.so
LoadModule speling_module modules/mod_speling.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule cache_module modules/mod_cache.so
LoadModule suexec_module modules/mod_suexec.so
LoadModule disk_cache_module modules/mod_disk_cache.so
LoadModule file_cache_module modules/mod_file_cache.so
LoadModule mem_cache_module modules/mod_mem_cache.so
LoadModule cgi_module modules/mod_cgi.so
#
# Load config files from the config directory "/etc/httpd/conf.d".
#
Include conf.d/*.conf
#
# ExtendedStatus controls whether Apache will generate "full" status
# information (ExtendedStatus On) or just basic information (ExtendedStatus
# Off) when the "server-status" handler is called. The default is Off.
#
#ExtendedStatus On

#
# ExtendedStatus:当调用“server-status”时,控制Apache是产生“全”状态
# 信息(ExtendedStatus On),还是产生基本信息(ExtendedStatus Off)。
# 默认为off
#
# ExtendedStatus On

### Section 2: 'Main' server configuration
#
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
# <VirtualHost> definition.  These values also provide defaults for
# any <VirtualHost> containers you may define later in the file.
#
# All of these directives may appear inside <VirtualHost> containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
#

### 第二区:“主”服务配置
#
# 这一区建立被 “主” 服务器用的指令值,以回应那些不被
# 定义处理的任何请求。
# 这些数值也提供默认值给后面定义的容器。
# 如果中有定义,那么这里定义的指令值将被
# 中的定义所覆盖。
#
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch. 
#
# User/Group: The name (or #number) of the user/group to run httpd as.
#  . On SCO (ODT 3) use "User nouser" and "Group nogroup".
#  . On HPUX you may not be able to use shared memory as nobody, and the
#    suggested workaround is to create a user www and use that user.
#  NOTE that some kernels refuse to setgid(Group) or semctl(IPC_SET)
#  when the value of (unsigned)Group is above 60000;
#  don't use Group #-1 on these systems!
#
User apache
Group apache
#
# 如果你想使httpd以另外的用户或组来运行,你必须在开始时以root方式启动
# 然后再将它切换为你想要使用的用户或组。
#
# User/Group:运行httpd的用户和组
# 在SCO (ODT3)上使用“User nouser”和“Group nogroup”
# 在HPUX上,你可能不能以nobody身份使用共享内存,建议创建一个www用户。
# 注意一些核心(kernel)在组ID大于60000时拒绝setgid(Group)或semctl(IPC_SET),
# 建议在这些系统上不要使用“Group #-1”。
#
User apache
Group apache
#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed.  This address appears on some server-generated pages, such
# as error documents.  e.g. [email]admin@your-domain.com[/email]
#
ServerAdmin root@localhost
#
# ServerAdmin:你的邮件地址,当发生问题时Apache将向你发出邮件。
# 作为一个出错文档,这个地址显示在server-generated页上,
# 例如:[email]admin@your-domain.com[/email]
#
ServerAdmin root@localhost
#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If this is not set to valid DNS name for your host, server-generated
# redirections will not work.  See also the UseCanonicalName directive.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
# You will have to access it by its address anyway, and this will make
# redirections work in a sensible way.
#
#ServerName new.host.name:80
#
# ServerName指定Apache用于识别自身的名字和端口号。
# 通常这个值是自动指定的,但是我们推荐你显式的指定它以防止启动时出错
#
# 如果你为你的主机指定了一个无效的DNS名,server-generated重定向将不能工作。
# 参见UseCanonicalName指令
#
# 如果你的主机没有注册DNS名,在这里键入它的IP地址
# 无论如何,你必须使用它的IP地址来提供服务,
# 这里使用一种容易理解的方式重定向服务
ServerName new.host.name:80
#
# UseCanonicalName: Determines how Apache constructs self-referencing
# URLs and the SERVER_NAME and SERVER_PORT variables.
# When set "Off", Apache will use the Hostname and Port supplied
# by the client.  When set "On", Apache will use the value of the
# ServerName directive.
#
UseCanonicalName Off

#
# UseCanonicalName:决定Apache如何构造URLS和 SERVER_NAME 和 SERVER_PORT 的指令。
# 当设置为 “Off”时,Apache会使用用户端提供的主机名和端口号。
# 当设置为“On”,Apache会使用ServerName指令的值。
#
UseCanonicalName Off

#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/var/www/html"
#
# DocumentRoot:你的文档的根目录。默认情况下,所有的请求从这个目录进行应答。
# 但是可以使用符号链接和别名来指向到其他的位置。
#
DocumentRoot "/var/www/html"
#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features. 
#
<Directory />
    Options FollowSymLinks
    AllowOverride None
</Directory>
#
# Apache可以存取的每个目录都可以配置存取权限(包括它的子目录)。
#
# 首先,我们配置一个高限制的特征。
# 这将禁止访问文件系统所在的目录,并添加你希望允许访问的目录块。
# 如下所示
Order Deny,Allow
Deny from all
#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#
#
# 注意从这里开始你一定要明确地允许哪些特别的特征能够被使用。
# - 所以,如果Apache没有象你所期待的那样工作的话,
# 请检查你是否在下面明确的指定它可用。
#

#
# This should be changed to whatever you set DocumentRoot to.
#
#
# 这将改变到你设置的DocumentRoot
#
<Directory "/var/www/html">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
#   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important.  Please see
# [url]http://httpd.apache.org/docs-2.0/mod/core.html#options[/url]
# for more information.
#
    Options Indexes FollowSymLinks

#
# Options:这个指令的值可以是“None”,“All”,或者下列选项的任意组合:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# 注意,“MultiViews”必须被显式的指定,“Options All”不能为你提供这个特性。
#
# 这个指令既复杂又重要,请参见
#“[url]http://httpd.apache.org/docs-2.0/mod/core.html#optioins[/url]”以取得更多的信息。
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
#   Options FileInfo AuthConfig Limit
#
    AllowOverride None
#
# AllowOverride控制那些被放置在.htaccess文件中的指令。
# 它可以是“All”,“None”,或者下列指令的组合:
# Options FileInfo AuthConfig Limit
#
AllowOverride None
#
# Controls who can get stuff from this server.
#
    Order allow,deny
    Allow from all
</Directory>

#
# 控制谁可以获得服务。
#
Order allow,deny
Allow from all

#
# UserDir: The name of the directory that is appended onto a user's home
# directory if a ~user request is received.
#
#
# UserDir:指定在得到一个~user请求时将会添加到用户home目录后的目录名。
#
#
# UserDir: The name of the directory that is appended onto a user's home
# directory if a ~user request is received.
#
# The path to the end user account 'public_html' directory must be
# accessible to the webserver userid.  This usually means that ~userid
# must have permissions of 711, ~userid/public_html must have permissions
# of 755, and documents contained therein must be world-readable.
# Otherwise, the client will only receive a "403 Forbidden" message.
#
# See also: [url]http://httpd.apache.org/docs/misc/FAQ.html#forbidden[/url]
#
<IfModule mod_userdir.c>
    #
    # UserDir is disabled by default since it can confirm the presence
    # of a username on the system (depending on home directory
    # permissions).
    #
    UserDir disable
    #
    # To enable requests to /~user/ to serve the user's public_html
    # directory, remove the "UserDir disable" line above, and uncomment
    # the following line instead:
    #
    #UserDir public_html
</IfModule>
#
# Control access to UserDir directories.  The following is an example
# for a site where these directories are restricted to read-only.
#
#<Directory /home/*/public_html>
#    AllowOverride FileInfo AuthConfig Limit
#    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
#    <Limit GET POST OPTIONS>
#        Order allow,deny
#        Allow from all
#    </Limit>
#    <LimitExcept GET POST OPTIONS>
#        Order deny,allow
#        Deny from all
#    </LimitExcept>
#</Directory>
 
 
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
# The index.html.var file (a type-map) is used to deliver content-
# negotiated documents.  The MultiViews Option can be used for the
# same purpose, but it is much slower.
#
DirectoryIndex index.html index.html.var
#
# DirectoryIndex:定义请求是一个目录时,Apache向用户提供服务的文件名
#
# index.html.var文件(一个类型映象文件)用于提供一个文档处理列表,
# 出于同样的目的,也可以使用MultiViews选项,但是它会非常慢。
#
DirectoryIndex  index.html index.html.var
#
# AccessFileName: The name of the file to look for in each directory
# for additional configuration directives.  See also the AllowOverride
# directive.
#
AccessFileName .htaccess

#
# AccessFileName:在每个目录中查询为目录提供附加配置指令的文件的文件名。
# 参见AllowOverride指令。
#
AccessFileName .htaccess

#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<Files ~ "^\.ht">
    Order allow,deny
    Deny from all
</Files>
#
# 下面的行防止.htaccess和.htpasswd文件被Web客户查看。
#
Order allow,deny
Deny from all
#
# TypesConfig describes where the mime.types file (or equivalent) is
# to be found.
#
TypesConfig /etc/mime.types
#
# Typeconfig:定义在哪里查询mime.types文件。
#
TypeConfig conf/mime.types
#
# DefaultType is the default MIME type the server will use for a document
# if it cannot otherwise determine one, such as from filename extensions.
# If your server contains mostly text or HTML documents, "text/plain" is
# a good value.  If most of your content is binary, such as applications
# or p_w_picpaths, you may want to use "application/octet-stream" instead to
# keep browsers from trying to display binary files as though they are
# text.
#
DefaultType text/plain

#
# DefaultType:定义当不能确定MIME类型时服务器提供的默认MIME类型。
# 如果你的服务主要包含text或HTML文档,“text/plain”是一个好的选择;
# 如果大多是二进制文档,诸如软件或图像,你应使用
# “application/octer-stream”来防止浏览器象显示文本那样显示二进制文件。
#
DefaultType text/plain
#
# The mod_mime_magic module allows the server to use various hints from the
# contents of the file itself to determine its type.  The MIMEMagicFile
# directive tells the module where the hint definitions are located.
#
<IfModule mod_mime_magic.c>
#   MIMEMagicFile /usr/share/magic.mime
    MIMEMagicFile conf/magic
</IfModule>
#
# mod_mime_magic允许服务器从自己定义自己类型的文件中使用不同的线索(hints),
# 这个MIMEMagicFile指令定义hints定义所在的文件。
#
MIMEMagicFile conf/magic
#
# HostnameLookups: Log the names of clients or just their IP addresses
# e.g., [url]www.apache.org[/url] (on) or 204.62.129.132 (off).
# The default is off because it'd be overall better for the net if people
# had to knowingly turn this feature on, since enabling it means that
# each client request will result in AT LEAST one lookup request to the
# nameserver.
#
HostnameLookups Off
#
# HostnameLookups:指定记录用户端的名字还是IP地址,例如,本指令为on时
# 记录主机名,如[url]www.apache.org[/url];为off时记录IP地址,204.62.129.132。
# 默认值为off,这要比设为on好得多,因为如果设为on则每个用户端请求都将会
# 至少造成对 nameserver 进行一次查询。
#
HostnameLookups Off

#
# EnableMMAP: Control whether memory-mapping is used to deliver
# files (assuming that the underlying OS supports it).
# The default is on; turn this off if you serve from NFS-mounted
# filesystems.  On some systems, turning it off (regardless of
# filesystem) can improve performance; for details, please see
# [url]http://httpd.apache.org/docs-2.0/mod/core.html#enablemmap[/url]
#
#EnableMMAP off

#
# EnableMMAP:控制是否进行内存转储(如果操作系统支持的话)。
# 默认为on,如果你的服务器安装在网络文件系统上(NFS),请关闭它。
# 在一些系统上,关闭它会提升系统性能(与文件系统类型无关);
# 具体情况请参阅[url]http://httpd.apache.org/docs-2.0/mod/core.html#enablemmap[/url]
#
# EnableMMAP off
#
# EnableSendfile: Control whether the sendfile kernel support is
# used to deliver files (assuming that the OS supports it).
# The default is on; turn this off if you serve from NFS-mounted
# filesystems.  Please see
# [url]http://httpd.apache.org/docs-2.0/mod/core.html#enablesendfile[/url]
#
#EnableSendfile off

#
# EnableSendfile:控制是否使用sendfile kernel支持发送文件
# (如果操作系统支持的话)。默认为on,如果你的服务器安装在网络文件系统
# (NFS)上,请你关闭它。
# 参见[url]http://httpd.apache.org/docs-2.0/mod/core.html#enablesendfile[/url]
#
# EnableSendfile off
#
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here.  If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog logs/error_log

#
# ErrorLog:错误日志文件定位。
# 如果你没有在内定义ErrorLog指令,这个虚拟主机的错误信息
# 将记录在这里。如果你在那儿定义了ErrorLog,这些错误信息将记录在你所
# 定义的文件里,而不是这儿定义的文件。
#
ErrorLog logs/error_log
#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn

#
# LogLevel:控制记录在错误日志文件中的日志信息数量。
# 可能的值包括:debug,info,notice,warn,error,crit,alert,emerg。
#
LogLevel warn

#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

#
# 下面的指令为CustomLog指令定义格式别名。
#
LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"" combined
LogFormat "%h %l %u %t "%r" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

#
# The location and format of the access logfile (Common Logfile Format).
# If you do not define any access logfiles within a <VirtualHost>
# container, they will be logged here.  Contrariwise, if you *do*
# define per-<VirtualHost> access logfiles, transactions will be
# logged therein and *not* in this file.
#
#CustomLog logs/access_log common
#
# 指定接入日志文件的定位和格式(一般日志格式)。
# 如果你没有在内定义这个指令,传输信息将记录在这里,
# 如果你定义了这个指令,则记录在你指定的位置,而不是这儿定义的位置。
#
CustomLog logs/access_log common

#
# If you would like to have agent and referer logfiles, uncomment the
# following directives.
#
#CustomLog logs/referer_log referer
#CustomLog logs/agent_log agent
#
# 如果你想要记录agent和referer信息,可以使用下面的指令
#
# CustomLog logs/referer_log referer
# CustomLog logs/agent_log agent

#
# For a single logfile with access, agent, and referer information
# (Combined Logfile Format), use the following directive:
#
CustomLog logs/access_log combined
#
# 如果你想要使用一个文件记录access,agent和referer信息,
# 你可以如下定义这个指令:
#
# CustomLog logs/access_log combined

#
# Optionally add a line containing the server version and virtual host
# name to server-generated pages (internal error documents, FTP directory
# listings, mod_status and mod_info output etc., but not CGI generated
# documents or custom error documents).
# Set to "EMail" to also include a mailto: link to the ServerAdmin.
# Set to one of:  On | Off | EMail
#
ServerSignature On
#
# 随意的添加包含服务器版本和虚拟主机名字一行信息到server-generated输出页中
# (内部错误文档,FTP目录列表,mod_status和mod_info输出等等,除了CGI错误
# 或自定义的错误文档以外)。
# 设为“EMail”将包含一个指向ServerAdmin的mailto:连接。
# 可以为如下值:On | Off | EMail
#
ServerSignature On

#
# Aliases: Add here as many aliases as you need (with no limit). The format is
# Alias fakename realname
#

#
# Aliases:在这时添加你需要的别名,格式如下:
# Alias 别名 真实名
#
# Note that if you include a trailing / on fakename then the server will
# require it to be present in the URL.  So "/icons" isn't aliased in this
# example, only "/icons/".  If the fakename is slash-terminated, then the
# realname must also be slash terminated, and if the fakename omits the
# trailing slash, the realname must also omit it.
#
# 注意,如果你在别名的未尾包含了“/”,那么在URL中也需要包含“/”。
# 因此,“/icons”不是这个示例中的别名。
# 如果别名中以“/”结尾,那么真实名也必须以“/”结尾,
# 如果别名中省略了结尾的“/”,那么真实名也必须省略。
#
# We include the /icons/ alias for FancyIndexed directory listings.  If you
# do not use FancyIndexing, you may comment this out.
#
Alias /icons/ "/var/www/icons/"
<Directory "/var/www/icons">
    Options Indexes MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
#
# 我们使用别名“/icons/”来表示FancyIndexed目录列表,如果你不使用、
# FancyIndexing,你可以注释掉它。
#
# Alias /icons/ "/usr/local/apache2/icons/"
#
# Options Indexes MultiViews
# AllowOverride None
# Order allow,deny
## Allow from all
#
#
# WebDAV module configuration section.
#
<IfModule mod_dav_fs.c>
    # Location of the WebDAV lock database.
    DAVLockDB /var/lib/dav/lockdb
</IfModule>
#
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the realname directory are treated as applications and
# run by the server when requested rather than as documents sent to the client.
# The same rules about trailing "/" apply to ScriptAlias directives as to
# Alias.
#
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
#
# ScriptAlias:指定包含服务脚本的目录。
# ScriptAliases 本质上与Aliases一样,除了这里的文档在请求时做为程序处理处理以外。
# 尾部的“/”规则与Alias一样
#
ScriptAlias /cgi-bin/ "/usr/loacl/apache2/cgi-bin/"

#
# Redirect allows you to tell clients about documents which used to exist in
# your server's namespace, but do not anymore. This allows you to tell the
# clients where to look for the relocated document.
# Example:
# Redirect permanent /foo [url]http://www.example.com/bar[/url]
 
#
# Redirect允许你告诉客户端使用存在于服务器名字空间中的文档,
# 而不是现在的,这帮助客户定位那些改变了位置的文档。
# 例如:
# Redirect permanent /foo [url]http://www.example.com/bar[/url]
#
# Directives controlling the display of server-generated directory listings.
#
#
# IndexOptions: Controls the appearance of server-generated directory
# listings.
#
IndexOptions FancyIndexing VersionSort NameWidth=*

#
# 控制server-generated目录列表显示的指令
#
#
# IndexOptions:控制server-generated目录列表显示特征。
#
IndexOptions FancyIndexing VersionSort NameWidth=*

#
# AddIcon* directives tell the server which icon to show for different
# files or filename extensions.  These are only displayed for
# FancyIndexed directories.
#
AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip
AddIconByType (TXT,/icons/text.gif) text/*
AddIconByType (IMG,/icons/p_w_picpath2.gif) p_w_picpath/*
AddIconByType (SND,/icons/sound2.gif) audio/*
AddIconByType (VID,/icons/movie.gif) video/*
AddIcon /icons/binary.gif .bin .exe
AddIcon /icons/binhex.gif .hqx
AddIcon /icons/tar.gif .tar
AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv
AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip
AddIcon /icons/a.gif .ps .ai .eps
AddIcon /icons/layout.gif .html .shtml .htm .pdf
AddIcon /icons/text.gif .txt
AddIcon /icons/c.gif .c
AddIcon /icons/p.gif .pl .py
AddIcon /icons/f.gif .for
AddIcon /icons/dvi.gif .dvi
AddIcon /icons/uuencoded.gif .uu
AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl
AddIcon /icons/tex.gif .tex
AddIcon /icons/bomb.gif core
AddIcon /icons/back.gif ..
AddIcon /icons/hand.right.gif README
AddIcon /icons/folder.gif ^^DIRECTORY^^
AddIcon /icons/blank.gif ^^BLANKICON^^
#
# AddIcon* 指令告诉服务器不同扩展名的图象文件如何显示,
# 只适用于FancyIndexed指令
#
AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip
AddIconByType (TXT,/icons/text.gif) text/*
AddIconByType (IMG,/icons/p_w_picpath2.gif) p_w_picpath/*
AddIconByType (SND,/icons/sound2.gif) audio/*
AddIconByType (VID,/icons/movie.gif) video/*
AddIcon /icons/binary.gif .bin .exe
AddIcon /icons/binhex.gif .hqx
AddIcon /icons/tar.gif .tar
AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv
AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip
AddIcon /icons/a.gif .ps .ai .eps
AddIcon /icons/layout.gif .html .shtml .htm .pdf
AddIcon /icons/text.gif .txt
AddIcon /icons/c.gif .c
AddIcon /icons/p.gif .pl .py
AddIcon /icons/f.gif .for
AddIcon /icons/dvi.gif .dvi
AddIcon /icons/uuencoded.gif .uu
AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl
AddIcon /icons/tex.gif .tex
AddIcon /icons/bomb.gif core
AddIcon /icons/back.gif ..
AddIcon /icons/hand.right.gif README
AddIcon /icons/folder.gif ^^DIRECTORY^^
AddIcon /icons/blank.gif ^^BLANKICON^^
#
# DefaultIcon is which icon to show for files which do not have an icon
# explicitly set.
#
DefaultIcon /icons/unknown.gif
#
# DefaultIcon 为那些没有显式定义图标的文件提供处理
#
DefaultIcon /icons/unknown.gif
#
# AddDescription allows you to place a short description after a file in
# server-generated indexes.  These are only displayed for FancyIndexed
# directories.
# Format: AddDescription "description" filename
#
#AddDescription "GZIP compressed document" .gz
#AddDescription "tar archive" .tar
#AddDescription "GZIP compressed tar archive" .tgz
#
# AddDescription允许你在server-generated索引后放置一个简短的说明。
# 只对FancyIndexed指令有效。
# 格式:AddDescription "说明" 文件名
#
# AddDescription "GZIP compressed document" .gz
# AddDescription "tar archive" .tar
# AddDescription "GZIP compressed tar archive" .tgz
#
# ReadmeName is the name of the README file the server will look for by
# default, and append to directory listings.
#
# HeaderName is the name of a file which should be prepended to
# directory indexes.
ReadmeName README.html
HeaderName HEADER.html
#
# ReadmeName指定服务器默认查找的README文件的名字,并添加到目录列表中
#
# HeaderName指定目录列表前缀文件的文件名
ReadmeName README.html
HeaderName HEADER.html

#
# IndexIgnore is a set of filenames which directory indexing should ignore
# and not include in the listing.  Shell-style wildcarding is permitted.
#
IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t
#
# IndexIgnore指定目录索引忽略并且不包含在列表中的文件名集合,
# 支持shell类型的通配符。
#
IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t

#
# DefaultLanguage and AddLanguage allows you to specify the language of
# a document. You can then use content negotiation to give a browser a
# file in a language the user can understand.
#

#
# DefaultLanguage和AddLanguage允许你指定文档的语言。
# 这使你可以让用户用容易理解的语言浏览文档。
#
#
# Specify a default language. This means that all data
# going out without a specific language tag (see below) will
# be marked with this one. You probably do NOT want to set
# this unless you are sure it is correct for all cases.
#

# * It is generally better to not mark a page as
# * being a certain language than marking it with the wrong
# * language!
#
# DefaultLanguage nl
# 指定默认的语言,这意味着所有没有指定语言的包都将使用该语言。
# 多数情况下,你也许并不想设置它,除非你确信这样做是正确的。
# 通常,不使用确定的语言比使用错误的语言要好。
#
# DefaultLanguage nl
#
# Note 1: The suffix does not have to be the same as the language
# keyword --- those with documents in Polish (whose net-standard
# language code is pl) may wish to use "AddLanguage pl .po" to
# avoid the ambiguity with the common suffix for perl scripts.
#
# 注意1:作为语言关键字的词缀毫无疑问是不能一样的--采用波兰
# 文的文档(网络标准语言代码是pl)将希望使用“AddLanguage pl .po”
# 来避免与perl脚本的一般词缀产生二义性。
#
#
# Note 2: The example entries below illustrate that in some cases
# the two character 'Language' abbreviation is not identical to
# the two character 'Country' code for its country,
# E.g. 'Danmark/dk' versus 'Danish/da'.
#
#
# 注意2: 下面的例子举例说明在一些范例中语言的二字符缩写与它的国家
# 的二字符缩写不相同,例如 “Danmark/dk” 和 “Danmark/da” 的比较.
#
#
# Note 3: In the case of 'ltz' we violate the RFC by using a three char
# specifier. There is 'work in progress' to fix this and get
# the reference data for rfc1766 cleaned up.
#
#
# 注意3: 在 “ltz” 的情况下我们使用三字符词缀,违犯了 RFC的规定,
# 运行中将修复它并使用RFC1766标准取得参考数据。
#
#
# Catalan (ca) - Croatian (hr) - Czech (cs) - Danish (da) - Dutch (nl)
# English (en) - Esperanto (eo) - Estonian (et) - French (fr) - German (de)
# Greek-Modern (el) - Hebrew (he) - Italian (it) - Japanese (ja)
# Korean (ko) - Luxembourgeois* (ltz) - Norwegian Nynorsk (nn)
# Norwegian (no) - Polish (pl) - Portugese (pt)
# Brazilian Portuguese (pt-BR) - Russian (ru) - Swedish (sv)
# Simplified Chinese (zh-CN) - Spanish (es) - Traditional Chinese (zh-TW)
#
#
AddLanguage ca .ca
AddLanguage cs .cz .cs
AddLanguage da .dk
AddLanguage de .de
AddLanguage el .el
AddLanguage en .en
AddLanguage eo .eo
AddLanguage es .es
AddLanguage et .et
AddLanguage fr .fr
AddLanguage he .he
AddLanguage hr .hr
AddLanguage it .it
AddLanguage ja .ja
AddLanguage ko .ko
AddLanguage ltz .ltz
AddLanguage nl .nl
AddLanguage nn .nn
AddLanguage no .no
AddLanguage pl .po
AddLanguage pt .pt
AddLanguage pt-BR .pt-br
AddLanguage ru .ru
AddLanguage sv .sv
AddLanguage zh-CN .zh-cn
AddLanguage zh-TW .zh-tw
#
# LanguagePriority allows you to give precedence to some languages
# in case of a tie during content negotiation.
#
# Just list the languages in decreasing order of preference. We have
# more or less alphabetized them here. You probably want to change this.
#
LanguagePriority en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv zh-CN zh-TW
# LanguagePriority允许你在会话过程中优先使用一些语言。
#
# 以优先次序递减的方式列出它们。我们或多或少地采用按字母排列顺序的方式
# 排列它们。也许你想要改变这个顺序。
LanguagePriority en da nl et fr de el it ja ko no pl pt pt-br ltz ca es sv tw

#
# ForceLanguagePriority allows you to serve a result page rather than
# MULTIPLE CHOICES (Prefer) [in case of a tie] or NOT ACCEPTABLE (Fallback)
# [in case no accepted languages matched the available variants]
#
ForceLanguagePriority Prefer Fallback
#
# ForceLanguagePriority 允许你为MULTIPLE CHOICES(Prefer)[在通讯的情况下]
# 或NOT ACCEPTABLE(Fallback)[没有可接受的语言匹配的情况]提供一个结果页。
#
ForceLanguagePriority Prefer Fallback
#
# Specify a default charset for all pages sent out. This is
# always a good idea and opens the door for future internationalisation
# of your web site, should you ever want it. Specifying it as
# a default does little harm; as the standard dictates that a page
# is in iso-8859-1 (latin1) unless specified otherwise i.e. you
# are merely stating the obvious. There are also some security
# reasons in browsers, related to javascript and URL parsing
# which encourage you to always set a default char set.
#
AddDefaultCharset UTF-8
#
# 为发送出的所有页指定默认的字符集,这总是一个好主意,并且为你的
# web站点的国际化打开了大门,这不正是你曾经想要的吗。同样地,指定
# 默认字符集有一些小的损害,如一个使用iso-8859-1(latin1)标准命令
# 的页面,除非以别的方式指定例如你仅仅以显式方式声明它。
# 也有一些与那些总是鼓励你使用默认字符集的javascropt和URL语法有关
# 的浏览器安全原因。
AddDefaultCharset UTF-8
#
# Commonly used filename extensions to character sets. You probably
# want to avoid clashes with the language extensions, unless you
# are good at carefully testing your setup after each change.
# See [url]http://www.iana.org/assignments/character-sets[/url] for the
# official list of charset names and their respective RFCs.
#
AddCharset ISO-8859-1  .iso8859-1  .latin1
AddCharset ISO-8859-2  .iso8859-2  .latin2 .cen
AddCharset ISO-8859-3  .iso8859-3  .latin3
AddCharset ISO-8859-4  .iso8859-4  .latin4
AddCharset ISO-8859-5  .iso8859-5  .latin5 .cyr .iso-ru
AddCharset ISO-8859-6  .iso8859-6  .latin6 .arb
AddCharset ISO-8859-7  .iso8859-7  .latin7 .grk
AddCharset ISO-8859-8  .iso8859-8  .latin8 .heb
AddCharset ISO-8859-9  .iso8859-9  .latin9 .trk
AddCharset ISO-2022-JP .iso2022-jp .jis
AddCharset ISO-2022-KR .iso2022-kr .kis
AddCharset ISO-2022-CN .iso2022-cn .cis
AddCharset Big5        .Big5       .big5
# For russian, more than one charset is used (depends on client, mostly):
AddCharset WINDOWS-1251 .cp-1251   .win-1251
AddCharset CP866       .cp866
AddCharset KOI8-r      .koi8-r .koi8-ru
AddCharset KOI8-ru     .koi8-uk .ua
AddCharset ISO-10646-UCS-2 .ucs2
AddCharset ISO-10646-UCS-4 .ucs4
AddCharset UTF-8       .utf8
#
# 一般以文件扩展名的方式使用字符集。也许你想要避免与语言扩展发生
# 碰撞,除非你在每次改变后都做了很好的测试。
# 参见[url]http://www.iana.org/assignments/character-sets[/url]以取得字符集
# 的名字列表和它们各自的RFCs。
#

# The set below does not map to a specific (iso) standard
# but works on a fairly wide range of browsers. Note that
# capitalization actually matters (it should not, but it
# does for some browsers).
#
# See [url]http://www.iana.org/assignments/character-sets[/url]
# for a list of sorts. But browsers support few.
#
AddCharset GB2312      .gb2312 .gb
AddCharset utf-7       .utf7
AddCharset utf-8       .utf8
AddCharset big5        .big5 .b5
AddCharset EUC-TW      .euc-tw
AddCharset EUC-JP      .euc-jp
AddCharset EUC-KR      .euc-kr
AddCharset shift_jis   .sjis
# 下面的字符集没有映射到一个特定的标准(iso)上,但是它们在浏览器
# 中被广泛的支持。注意那些大写字母。
# (它不应该,但是它是为兼容一些浏览器而做)
#
# 参见[url]http://www.iana.org/assianments/character-sets[/url]以取得
# 它们的列表。但是浏览器支持较少。
#

#
# AddType allows you to add to or override the MIME configuration
# file mime.types for specific file types.
#
#AddType application/x-tar .tgz

#
# AddType允许你为指定的文件类型添加或覆盖mime.types文件中配置的MIME
#
#AddType application/x-tar .tgz
#
# AddEncoding allows you to have certain browsers uncompress
# information on the fly. Note: Not all browsers support this.
# Despite the name similarity, the following Add* directives have nothing
# to do with the FancyIndexing customization directives above.
#
#AddEncoding x-compress .Z
#AddEncoding x-gzip .gz .tgz
# If the AddEncoding directives above are commented-out, then you
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
#
# AddHandler allows you to map certain file extensions to "handlers":
# actions unrelated to filetype. These can be either built into the server
# or added with the Action directive (see below)
#
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
#AddHandler cgi-script .cgi

#
# AddHandler允许你映射确定的文件扩展名到“handlers”:
# 与文件类型无关的行为。这既能编译到服务器中也可以添加到Action指令
# 中(看下面)。
# 为了在ScriptAliased指令指定的以外使用CGI脚本:
#(要使它可用,你还需要在Options中添加“ExecCGI”。
#
# AddHandler cgi-script .cgi

#
# For files that include their own HTTP headers:
#
#AddHandler send-as-is asis
#
# For server-parsed p_w_picpathmap files:
#
AddHandler imap-file map
#
# 对于那些包含他们自己的HTTP头的文件
#
# AddHandler send-as-is asis
#
# 对于server-parsed p_w_picpathmap文件:
#
# AddHandler imap-file map
#
# For type maps (negotiated resources):
# (This is enabled by default to allow the Apache "It Worked" page
#  to be distributed in multiple languages.)
#
AddHandler type-map var
#
# Filters allow you to process content before it is sent to the client.
#
# To parse .shtml files for server-side includes (SSI):
# (You will also need to add "Includes" to the "Options" directive.)
#
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
#
# agemap 文件:
#
#AddHandler imap- 文件映像
#
# 对于类型映像:(转移资源)
#(这是默认的设定以允许Apache的“It Worked”页能多种语言分发)。
#
AddHandler type-map var
#
# 过滤器允许你在将它发送到客户端前进行处理。
#
# 为了在服务器端分析包含(SSI)的.shtml文档:
# (要执行这个指令,你还需要在Options指令中添加“Includes”。)
#
# AddType text/html .shtml
# AddOutputFilter INCLUDES .shtml
#
# Action lets you define media types that will execute a script whenever
# a matching file is called. This eliminates the need for repeated URL
# pathnames for oft-used CGI file processors.
# Format: Action media/type /cgi-script/location
# Format: Action handler-name /cgi-script/location
#
#
# Action让你定义当调用匹配的媒体文件时将要执行的脚本。这将减少
# 那些经常使用的CGI脚本的URL路径名的重复输入。
# 格式:Action media/type /cgi-script/location
# 格式:Action handler-name /cgi-script/location
#
#
# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
#
# Some examples:
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 [url]http://www.example.com/subscription_info.html[/url]
#

#
# 可配置的错误应答有三种风格:
# 1)plain text 2)local redirects 3) external redirects
#
# 一些示例:
# ErrorDocument 500 "The server made a boo boo."
# ErrorDocument 404 /missing.html
# ErrorDocument 404 "/cgi-bin/missing_handler.pl"
# ErrorDocument 402 [url]http://www.example.com/subscription_info.html[/url]
#

#
# Putting this all together, we can internationalize error responses.
#
# We use Alias to redirect any /error/HTTP_<error>.html.var response to
# our collection of by-error message multi-language collections.  We use
# includes to substitute the appropriate text.
#

#
# 综合应用这些指令,我们可以创建一个国际化的出错应答。
#
# 我们使用Alias来重定向任意/error/HTTP_.html.var应答到
# 我们的多语言错误消息集合。使用正确的文本替代它。
#
#
# You can modify the messages' appearance without changing any of the
# default HTTP_<error>.html.var files by adding the line:
#
#   Alias /error/include/ "/your/include/path/"
#
# which allows you to create your own set of files by starting with the
# /var/www/error/include/ files and
# copying them to /your/include/path/, even on a per-VirtualHost basis.
#
Alias /error/ "/var/www/error/"
<IfModule mod_negotiation.c>
<IfModule mod_include.c>
    <Directory "/var/www/error">
        AllowOverride None
        Options IncludesNoExec
        AddOutputFilter Includes html
        AddHandler type-map var
        Order allow,deny
        Allow from all
        LanguagePriority en es de fr
        ForceLanguagePriority Prefer Fallback
    </Directory>
#
# 通过加入下面的行,你就能够改变这些消息的显示,而不必改变
# HTTP_.html.var文件。
#
# Alias /error/include/ "/your/include/path/"
#
# 以将/usr/local/apache2/error/include/下的文件拷贝到/your/inclue/path/下
# 开始,你可以创建你自己的文件集合,甚至是其于每个虚拟主机的。
# 不管你的ServerSignature如何设置,默认的包含文件将显示你的
# Aapche版本号和你的ServerAdmin邮件地址
#
# 国际化的错误文档需要mod_alias,mod_include和mod_negotiation三个
# 模块。要激活它们,取消下面30行的注释符号
# Alias /error/ "/usr/local/apache2/error/"
#
#
# AllowOverride None
# Options IncludesNoExec
# AddOutputFilter Includes html
# AddHandler type-map var
# Order allow,deny
# Allow from all
# LanguagePriority en de es fr it nl sv
# ForceLanguagePriority Prefer Fallback
#
#    ErrorDocument 400 /error/HTTP_BAD_REQUEST.html.var
#    ErrorDocument 401 /error/HTTP_UNAUTHORIZED.html.var
#    ErrorDocument 403 /error/HTTP_FORBIDDEN.html.var
#    ErrorDocument 404 /error/HTTP_NOT_FOUND.html.var
#    ErrorDocument 405 /error/HTTP_METHOD_NOT_ALLOWED.html.var
#    ErrorDocument 408 /error/HTTP_REQUEST_TIME_OUT.html.var
#    ErrorDocument 410 /error/HTTP_GONE.html.var
#    ErrorDocument 411 /error/HTTP_LENGTH_REQUIRED.html.var
#    ErrorDocument 412 /error/HTTP_PRECONDITION_FAILED.html.var
#    ErrorDocument 413 /error/HTTP_REQUEST_ENTITY_TOO_LARGE.html.var
#    ErrorDocument 414 /error/HTTP_REQUEST_URI_TOO_LARGE.html.var
#    ErrorDocument 415 /error/HTTP_UNSUPPORTED_MEDIA_TYPE.html.var
#    ErrorDocument 500 /error/HTTP_INTERNAL_SERVER_ERROR.html.var
#    ErrorDocument 501 /error/HTTP_NOT_IMPLEMENTED.html.var
#    ErrorDocument 502 /error/HTTP_BAD_GATEWAY.html.var
#    ErrorDocument 503 /error/HTTP_SERVICE_UNAVAILABLE.html.var
#    ErrorDocument 506 /error/HTTP_VARIANT_ALSO_VARIES.html.var
</IfModule>
</IfModule>

#
# The following directives modify normal HTTP response behavior to
# handle known problems with browser implementations.
#
BrowserMatch "Mozilla/2" nokeepalive
BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
BrowserMatch "RealPlayer 4\.0" force-response-1.0
BrowserMatch "Java/1\.0" force-response-1.0
BrowserMatch "JDK/1\.0" force-response-1.0
#
# 下面的命令更改标准的HTTP应答行为以处理己知的浏览器问题。
#
BrowserMatch "Mozilla/2" nokeepalive
BrowserMatch "MSIE 4.0b2;" nokeepalive downgrade-1.0 force-response-1.0
BrowserMatch "RealPlayer 4.0" force-response-1.0
BrowserMatch "Java/1.0" force-response-1.0
BrowserMatch "JDK/1.0" force-response-1.0
#
# The following directive disables redirects on non-GET requests for
# a directory that does not include the trailing slash.  This fixes a
# problem with Microsoft WebFolders which does not appropriately handle
# redirects for folders with DAV methods.
# Same deal with Apple's DAV filesystem and Gnome VFS support for DAV.
#
BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
BrowserMatch "^WebDrive" redirect-carefully
BrowserMatch "^WebDAVFS/1.[012]" redirect-carefully
BrowserMatch "^gnome-vfs" redirect-carefully

#
# 下面命令关闭对那些没有尾部“/”的目录的非GET请求的重定向,
# 这些命令修复了微软的采用DAV方法不能正确处理重定向的WEB文件夹的问题。
# Apple下的DAV文件系统和Gnome下的VFS对DAV的支持也是采用这样的方法
# 进行处理的。
#
BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
BrowserMatch "^WebDrive" redirect-carefully
BrowserMatch "^WebDAVFS/1.[012]" redirect-carefully
BrowserMatch "^gnome-vfs" redirect-carefully

#
# Allow server status reports generated by mod_status,
# with the URL of [url]http://servername/server-status[/url]
# Change the ".example.com" to match your domain to enable.
#
#<Location /server-status>
#    SetHandler server-status
#    Order deny,allow
#    Deny from all
#    Allow from .example.com
#</Location>
#
# 允许你使用URL:[url]http://servername/server-status[/url]来通过mod_status生
# 成并报告服务器状态信息。改变.example.com为你自己的域名。
#
#
# SetHandler server-status
# Order deny,allow
# Deny from all
# Allow from .example.com
#

#
# Allow remote server configuration reports, with the URL of
[url]http://servername/server-info[/url] (requires that mod_info.c be loaded).
# Change the ".example.com" to match your domain to enable.
#
#<Location /server-info>
#    SetHandler server-info
#    Order deny,allow
#    Deny from all
#    Allow from .example.com
#</Location>
#
# 允许使用[url]http://servername/server-info[/url]来远程报告服务器配置信息
# (需要mod_info.c支持)。改变“.example.com”为你自己的域名。
#
#
# SetHandler server-info
# Order deny,allow
# Deny from all
# Allow from .example.com
#

#
# Proxy Server directives. Uncomment the following lines to
# enable the proxy server:
#
#<IfModule mod_proxy.c>
#ProxyRequests On
#
#<Proxy *>
#    Order deny,allow
#    Deny from all
#    Allow from .example.com
#</Proxy>

#
# 代理服务器命令,去掉下面的行使代理服务可用。
#
#
# ProxyRequests On
#
# Order deny,allow
# Deny from all
# Allow from .example.com
#

#
# Enable/disable the handling of HTTP/1.1 "Via:" headers.
# ("Full" adds the server version; "Block" removes all outgoing Via: headers)
# Set to one of: Off | On | Full | Block
#
#ProxyVia On
#
# 安装或关闭HTTP/1.1“通道”头处理。
# (“Full”添加服务器版本信息,“Block”移掉所有输出“通道”头信息。
# 可以设为下面各选项之一:Off | On | Full | Block
#
# ProxyVia On
#
# To enable a cache of proxied content, uncomment the following lines.
# See [url]http://httpd.apache.org/docs-2.0/mod/mod_cache.html[/url] for more details.
#
#<IfModule mod_disk_cache.c>
#   CacheEnable disk /
#   CacheRoot "/var/cache/mod_proxy"
#</IfModule>
#
#</IfModule>
# End of proxy directives.
# 最好为代理服务安装高速缓冲,去掉下面几行的注释符号:
# (没有CacheRoot则不缓冲)
#
### Section 3: Virtual Hosts
#
# VirtualHost: If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:[url]http://httpd.apache.org/docs-2.0/vhosts/[/url]>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
# Use name-based virtual hosting.
#
#NameVirtualHost *:80
#
# NOTE: NameVirtualHost cannot be used without a port specifier
# (e.g. :80) if mod_ssl is being used, due to the nature of the
# SSL protocol.
#
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
#<VirtualHost *:80>
#    ServerAdmin [email]webmaster@dummy-host.example.com[/email]
#    DocumentRoot /www/docs/dummy-host.example.com
#    ServerName dummy-host.example.com
#    ErrorLog logs/dummy-host.example.com-error_log
#    CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>
## 第三区:虚拟主机
#
# VirtualHost:你可以通过设置虚拟主机容器以实现在你的主机上保有多个
# 域名/主机名。大多数配置信息只使用基于名字的虚拟主机,因此服务器
# 不必担心IP地址的问题,下面的命令以*号代替虚拟主机名。
#
# 在你试着配置你的虚拟主机以前,请参见
# [url]http://httpd.apache.org/docs-2.0/vhosts/[/url]>以取得更多的信息。
#
# 你可以使用命令行选项“-S”来检验你的虚拟主机配置。
#
# 使用基于名字的虚拟主机。
#
# NameVirtualHost *
#
# 虚拟主机示例:
# 几乎所有的Apache命令都可以在虚拟主机容器中使用。
# 第一个虚拟主机区是用于向服务名未知的请求进行应答的配置。
#
# <VirtualHost *>
# ServerAdmin [email]webmaster@dummy-host.example.com[/email]
# DocumentRoot /www/docs/dummy-host.example.com
# ServerName dummy-host.example.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log commom
# </virtualHost>