1.
# Deny access to the entirety of your server‘s filesystem. You must
# explicitly permit access to web content directories in other
# <Directory> blocks below.
#拒绝所有对你服务器文件系统的访问。你必须在下面其它的<Directory>区明确许可访问web内容目录
#
<Directory />
AllowOverride none
Require all denied
</Directory>
2.
# 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:你要使用【serve】的文档的目录。默认为所有请求都从这个目录获取,但是可以使用符号连接【symbolic link】和别名指定其它位置。
#【下面这个指令指定文档目录,也就是网站的根目录】
DocumentRoot "c:/Apache24/htdocs"
<Directory "c:/Apache24/htdocs">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#可能的设置指令值是“None”,“All”,或者以下任意组合:
#Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn‘t give it to you.
#注意那个"MultiViews"必须准确命名-----“Options All”将不会起什么作用【doesn‘t give it to you】【?】
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#选项指令复杂且重要。请参阅http://httpd.apache.org/docs/2.4/mod/core.html#options以得到更多信息
#
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
# AllowOverride控制的指令可能包含在.htaccess文件中。它可以是“all”、“None”、或以下关键字的任意组合:
# AllowOverride FileInfo AuthConfig Limit
#
AllowOverride None
#
# Controls who can get stuff from this server.
#下面的指令控制谁能从这台服务器上获取东西
#
Require all granted
</Directory>
3.
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
# DirectoryIndex:设置当Apache服务得到一个目录请求的时候访问的文件【即默认首页】
#
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
4.
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#下面的行禁止.htaccess和.htpasswd文件被web客户端查看【禁止从浏览器访问.htaccess和.htpasswd文件】
#
<Files ".ht*">
Require all denied
</Files>
5.
# 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:错误日志文件的位置。如果你没有在<VirtualHost>容器中指定一个ErrorLog指令,与那个虚拟主机相关的错误消失将记录在这里。如果你确实为一个<VirtualHost>容器定义了错误消息文件,那么主机的错误日志将被记录在那里而不是这里。
#
ErrorLog "logs/error.log"
6.
<IfModule alias_module>
#
# Redirect: Allows you to tell clients about documents that used to
# exist in your server‘s namespace, but do not anymore. The client
# will make a new request for the document at its new location.
#Redirect:允许你通知客户端以前存在于服务器名字空间的文档,现在已经不存在了。客户端将发送一个新请求以获得新的文档位置。
# Example:
# Redirect permanent /foo http://www.example.com/bar
#
# Alias: Maps web paths into filesystem paths and is used to
# access content that does not live under the DocumentRoot.
# Alias:别名,映射网络路径到文件系统路径并被且用于访问不存在于网站根目录的内容。
# Example:
# Alias /webpath /full/filesystem/path
#
# If you include a trailing / on /webpath then the server will
# require it to be present in the URL. You will also likely
# need to provide a <Directory> section to allow access to
# the filesystem path.
#如果你包含了 trainng/on/webpath 那么服务器将获取它并呈现在URL中。【?】
#
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the target 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:脚本别名,它控制着那些包含服务器脚本的目录。“脚本别名”本质上与“别名”是相同的,除非目标目录中的文档被当作应用程序对待并且当被请求时由服务器运行而不是当作文档被发送到客户端。【当目标目录中的文档是应用程序,客户端有请求时被服务器运行,而不是以文档形式被发送到客户端,只有这个时候脚本别名与别名是不同的】【?】。以斜杠“/”结尾这个规则对于ScriptAlias和Alias指令是相同的。
#
ScriptAlias /cgi-bin/ "c:/Apache24/cgi-bin/"
</IfModule>
7.
<IfModule mime_module>
#
# TypesConfig points to the file containing the list of mappings from filename extension to MIME-type.
# TypesConfig指向一个文件,这个文件包含一个从文件扩展名到mime-type的映射列表【TypesConfig指向一个文件,这个文件包含一个文件扩展名与mime-type的映射列表】
#
TypesConfig conf/mime.types
#
# AddType allows you to add to or override the MIME configuration
# file specified in TypesConfig for specific file types.
# AddType允许你为特殊的文件类型添加或覆盖在TypesConfig中规定的mime配置文件
#
#AddType application/x-gzip .tgz
#
# AddEncoding allows you to have certain browsers uncompress information on the fly. Note: Not all browsers support this.
# AddEncoding允许你有特定的浏览器解压缩信息的自适应能力。注意:并非所有浏览器都支持。
#
#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:
#如果上面的AddEncoding指令被注释,那么你可能应该定义那些扩展名以指出媒体类型。
#
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)
# AddHandler允许你映射特定文件扩展名到"handlers":动作与文件类型无关。这也可以内建于服务器或者与动作指令【Action directive】一起添加(看下面)
#
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#为了在脚本别名指定的目录外使用CGI脚本:(你也需要添加"ExecCGI"到"Options"指令)
#AddHandler cgi-script .cgi
# For type maps (negotiated resources):为了类型映射(协议资源)【?】
#AddHandler type-map var
#
# Filters allow you to process content before it is sent to the client.
# Filters允许你在内容被发送到客户端之前处理它。
#
# To parse .shtml files for server-side includes (SSI):
# (You will also need to add "Includes" to the "Options" directive.)
#为“服务器端包含”分析.shtml文件:(你也需要添加“includes”到"Options"指令)
#AddType text/html .shtml
#AddOutputFilter INCLUDES .shtml
</IfModule>
8.
# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
#可定制的错误响应支持三种方式:1)明文 2)本地重定向 3)外部重定向
# Some examples:
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html
#
#
# MaxRanges: Maximum number of Ranges in a request before
# returning the entire resource, or one of the special
# values ‘default‘, ‘none‘ or ‘unlimited‘.
# Default setting is to accept 200 Ranges.
# MaxRanges:定义了在一个请求返回全部资源之前Ranges的最大数字,或者在‘default‘, ‘none‘ or ‘unlimited‘三个值中指定的一个值。
#MaxRanges unlimited
9.
# Server-pool management (MPM specific)
#服务器池管理
#Include conf/extra/httpd-mpm.conf
# Multi-language error messages 多语言错误消息
#Include conf/extra/httpd-multilang-errordoc.conf
# Fancy directory listings动态目录列表形式配置
#Include conf/extra/httpd-autoindex.conf
# Language settings 语言设置
#Include conf/extra/httpd-languages.conf
# User home directories 用户家庭目录
#Include conf/extra/httpd-userdir.conf
# Real-time info on requests and configuration 请求和配置上的实时信息
#Include conf/extra/httpd-info.conf
# Virtual hosts 虚拟主机
#Include conf/extra/httpd-vhosts.conf
# Local access to the Apache HTTP Server Manual 本地访问Apache Http Server手册。
#Include conf/extra/httpd-manual.conf
# Distributed authoring and versioning (WebDAV) 分布式创作和版本控制
#Include conf/extra/httpd-dav.conf
# Various default settings 多种类默认设置
#Include conf/extra/httpd-default.conf
10.
# Configure mod_proxy_html to understand HTML4/XHTML1 配置mod_proxy_html,使它支持HTML4/XHTML1
<IfModule proxy_html_module>
Include conf/extra/proxy-html.conf
</IfModule>
# Secure (SSL/TLS) connections安全连接
#Include conf/extra/httpd-ssl.conf