欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  网络运营

APACHE 配置文件中文版 httpd.conf FOR Apache 2.2.13

程序员文章站 2022-05-27 07:54:15
# # this is the main apache http server configuration file. it contains the # configur...
#
# this is the main apache http server configuration file. it contains the
# configuration directives that give the server its instructions.
# see <url:http://httpd.apache.org/docs/2.2/> for detailed information.
# in particular, see
# <url:http://httpd.apache.org/docs/2.2/mod/directives.html>
# for a discussion of each configuration directive.
#
# 这是apache server的主配置文件. 它包含配置指令,来指示服务器。
# 参考 http://httpd.apache.org/docs/2.2/mod/directives.html 了解关于指令的详细信息。
# 另外,参看 http://httpd.apache.org/docs/2.2/mod/directives.html 获取每个配置指令的讨论。


# 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').
# 1.控制apache server的全局操作的指令(全局环境变量)。
#
# 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.
# 2. 配置主服务或者默认服务的指令,它针对那些被虚拟主机以外的请求作出响应。
# 它也包含虚拟主机的一些默认参数。
#
# 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.
# 3. 虚拟主机设置,这使得发往不同的ip或者主机名的请求可以被子同一个apache服务器处理。


# 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 "e:/usr/apache2.2" will be interpreted by the
# server as "e:/usr/apache2.2/logs/foo.log".
#
# 配置和日志文件名:如果你所指定的文件名以“/”(在win32中以“盘符:/”)开头,
# 服务器将以绝对路径来处理。如果文件名不以“/”开头,则以相对路径处理,
# 相对于服务器根(serverroot)。因此“logs/foo.log”,如果服务器根目录
# 为“e:/usr/apache2.2”,则服务器解释为“e:/usr/apache2.2/logs/foo.log”。


#
# note: where filenames are specified, you must use forward slashes
# instead of backslashes (e.g., "c:/apache" instead of "c:\apache").
# 注意:在文件名的定义中,必须用正斜杠,而不是反斜杠。(比如,“c:/apache”,而不是“c:\apache”)
#
# if a drive letter is omitted, the drive on which apache.exe is located
# will be used by default. it is recommended that you always supply
# an explicit drive letter in absolute paths, however, to avoid
# confusion.
# 如果省略了盘符,则以apache.exe所在的盘符为默认值。建议在绝对路径中明确
# 指定盘符,以避免混乱。


# threadsperchild: constant number of worker threads in the server process
# maxrequestsperchild: maximum number of requests a server process serves
# threadsperchild:每个服务进程中的工作线程常数
# maxrequestsperchild:服务进程中允许的最大请求数目
threadsperchild 250
maxrequestsperchild 0


#
# serverroot: the top of the directory tree under which the server's
# configuration, error, and log files are kept.
# 指出服务器保存其配置、出错和日志文件等的根目录
#
# do not add a slash at the end of the directory path. if you point
# serverroot at a non-local disk, be sure to point the lockfile directive
# at a local disk. if you wish to share the same serverroot for multiple
# httpd daemons, you will need to change at least lockfile and pidfile.
#
# 不要在目录的末尾加上斜杠。如果你想将serverroot指向非本地硬盘上,请添加卷到本地硬盘上。
# 如果你想共享 serverroot 给多个httpd镜像服务,你必须改变lockfile和pidfile。
#
serverroot "e:/usr/apache2.2"


#
# listen: allows you to bind apache to specific ip addresses and/or
# ports, instead of the default. see also the <virtualhost>
# directive.
# listen:允许你绑定apache服务到指定的ip地址和端口上,以取代默认值。请同时参考<virtualhost>
# 指令。
#
# 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)
# 像下面那样使apache只在指定的ip地址上监听,以防止它在ip地址0.0.0.0上监听。
#
#listen 12.34.56.78:80
listen 8080

#
# dynamic shared object (dso) support
# 动态共享对象(dso)支持
#
# 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.
# 为了能够使用那些以dso模式编译的模块中的函数,你必须放置相应的“loadmodule”行在这里,以便
# 包含在其后的指令在使用之前激活。
# 那些静态编译的模块(即以“httpd -l”列出的模块)则不需要在这里加载。
#
# example:
# loadmodule foo_module modules/mod_foo.so
#
loadmodule actions_module modules/mod_actions.so
loadmodule alias_module modules/mod_alias.so
loadmodule asis_module modules/mod_asis.so
loadmodule auth_basic_module modules/mod_auth_basic.so
#loadmodule auth_digest_module modules/mod_auth_digest.so
#loadmodule authn_anon_module modules/mod_authn_anon.so
#loadmodule authn_dbm_module modules/mod_authn_dbm.so
loadmodule authn_default_module modules/mod_authn_default.so
loadmodule authn_file_module modules/mod_authn_file.so
#loadmodule authz_dbm_module modules/mod_authz_dbm.so
loadmodule authz_default_module modules/mod_authz_default.so
loadmodule authz_groupfile_module modules/mod_authz_groupfile.so
loadmodule authz_host_module modules/mod_authz_host.so
loadmodule authz_user_module modules/mod_authz_user.so
loadmodule autoindex_module modules/mod_autoindex.so
#loadmodule cern_meta_module modules/mod_cern_meta.so
loadmodule cgi_module modules/mod_cgi.so
#loadmodule dav_module modules/mod_dav.so
#loadmodule dav_fs_module modules/mod_dav_fs.so
#loadmodule deflate_module modules/mod_deflate.so
loadmodule dir_module modules/mod_dir.so
loadmodule env_module modules/mod_env.so
#loadmodule expires_module modules/mod_expires.so
#loadmodule file_cache_module modules/mod_file_cache.so
#loadmodule headers_module modules/mod_headers.so
loadmodule imagemap_module modules/mod_imagemap.so
loadmodule include_module modules/mod_include.so
#loadmodule info_module modules/mod_info.so
loadmodule isapi_module modules/mod_isapi.so
loadmodule log_config_module modules/mod_log_config.so
loadmodule mime_module modules/mod_mime.so
#loadmodule mime_magic_module modules/mod_mime_magic.so
#loadmodule proxy_module modules/mod_proxy.so
#loadmodule proxy_ajp_module modules/mod_proxy_ajp.so
#loadmodule proxy_balancer_module modules/mod_proxy_balancer.so
#loadmodule proxy_connect_module modules/mod_proxy_connect.so
#loadmodule proxy_http_module modules/mod_proxy_http.so
#loadmodule proxy_ftp_module modules/mod_proxy_ftp.so
loadmodule negotiation_module modules/mod_negotiation.so
#loadmodule rewrite_module modules/mod_rewrite.so
loadmodule setenvif_module modules/mod_setenvif.so
#loadmodule speling_module modules/mod_speling.so
#loadmodule status_module modules/mod_status.so
#loadmodule unique_id_module modules/mod_unique_id.so
loadmodule userdir_module modules/mod_userdir.so
#loadmodule usertrack_module modules/mod_usertrack.so
#loadmodule vhost_alias_module modules/mod_vhost_alias.so
#loadmodule ssl_module modules/mod_ssl.so
loadmodule php5_module "e:/usr/php/php5apache2_2.dll"

# 配置 php.ini 的路径
phpinidir "e:/usr/php"

# '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.
#
# 本节中指令的设置值,将被主服务所使用,主服务响应那些没有被<virtualhost>所处理的请求,
# 这些值也为<virtualhost>容器提供了默认值,你可以在后面的文件中定义
#
# all of these directives may appear inside <virtualhost> containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
#
# 所有这些指令将出现在<virtualhost>容器中,这些设定值将在定义virtual host时被覆写。


#
# 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. admin@your-domain.com
# serveradmin: 你的地址,当系统故障时,可以给你发email。
# 此地址出现在那些由服务器生成的页面上,如出错文档。例如:admin@your-domain.com
#
serveradmin indian@163.com

#
# 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.
# servernaem 定义了server名称和端口号,用以标明自己的身份。
# 通常可以自动定义,建议明确地指定它,避免起动时出错
# if your host doesn't have a registered dns name, enter its ip address here.
# 如果你没有注册dns名字,请在这里输入ip地址。
servername www.kysf.net:8080

#
# 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: 你的文档的根目录。默认情况下,所有的请求都从这里开始,
# 但是可以使用符号链接和别名来指向到其他的位置。
#
documentroot "e:/usr/apache2.2/htdocs"


#
# 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).
# 每个可供apache访问的目录,可以配置成允许和(或)禁止哪些服务和特性(包括其子目录)
#
# first, we configure the "default" to be a very restrictive set of
# features.
# 首先,我们定义一个默认的非常严格的配置
#
<directory />
options followsymlinks
allowoverride none
order deny,allow
deny from all
satisfy all
</directory>

#
# 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 "e:/usr/apache2.2/htdocs">

#
# possible values for the options directive are "none", "all",
# or any combination of:
# indexes includes followsymlinks symlinksifownermatch execcgi multiviews
#
#options:这个指令的值可以是“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”不能为你提供这个特性。
#
# the options directive is both complicated and important. please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
# options 指令既复杂又重要,请参见 http://httpd.apache.org/docs/2.2/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:
# options fileinfo authconfig limit
#
# 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>

#
# directoryindex: sets the file that apache will serve if a directory
# is requested.
#
# directoryindex: 当请求是一个目录时,apache向用户提供服务的文件名。(即默认文档名。-译者注。)
#
<ifmodule dir_module>
directoryindex index.html
</ifmodule>

#
# the following lines prevent .htaccess and .htpasswd files from being
# viewed by web clients.
# #下面的设置是防止.htaccess和.htpasswd(访问设定和密码)文件被web客户查看。
#
<filesmatch "^\.ht">
order allow,deny
deny from all
</filesmatch>

#
# 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,这些错误信息将记录在你所
# 定义的文件里,而不是这里定义的文件。
#
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: 控制记录在错误日志文件中的日志信息数量。
# 可能的值包括: debug, info, notice, warn, error, crit, alert, emerg.
#
loglevel warn

<ifmodule log_config_module>
#
# the following directives define some format nicknames for use with
# a customlog directive (see below).
#
# 下面的参数设置是为customlog指令定义格式别名(看下面)。
#
#
logformat "%h %l %u %t \"%r\" %>s %b \"%{referer}i\" \"%{user-agent}i\"" combined
logformat "%h %l %u %t \"%r\" %>s %b" common

<ifmodule logio_module>
# you need to enable mod_logio.c to use %i and %o
#
# 你需要安装了mod_logio.c模块才能使用%i和%o
#
logformat "%h %l %u %t \"%r\" %>s %b \"%{referer}i\" \"%{user-agent}i\" %i %o" combinedio
</ifmodule>

#
# 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.
#
# 指定访问日志文件的位置和格式(一般日志格式)。
# 如果你没有在<virtualhost>内定义这个指令,处理信息将记录在这里,
# 如果你定义了这个指令,则处理信息记录在你指定的位置,而不是这儿定义的位置。
#
customlog logs/access.log common

#
# if you prefer a logfile with access, agent, and referer information
# (combined logfile format) you can use the following directive.
#
# 如果你想要使用一个文件记录access,agent和referer信息(组合日志格式),
# 你可以如下定义这个指令:
#
#customlog logs/access.log combined
</ifmodule>

<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.kysf.net/bar

#
# alias: maps web paths into filesystem paths and is used to
# access content that does not live under the documentroot.
#
#alias: 映射web路径到文件系统路径,通常用于访问不在documentroot里面的内容
#
# 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.
#
# 如果web路径中有后缀“/”,则服务器要求有后缀“/”来描述url。你也可以用 <directory> 片段
# 允许访问文件系统路径。


#
# 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: 指定包含服务脚本的目录。
# scriptaliases本质上与aliases一样,除了这里的文档在请求时做为程序处理和运行,
# 而不是作为文档发送到客户端。尾部的“/”规则与alias一样。
#
scriptalias /cgi-bin/ "e:/usr/apache2.2/cgi-bin/"

</ifmodule>

#
# "e:/usr/apache2.2/cgi-bin" should be changed to whatever your scriptaliased
# cgi directory exists, if you have that configured.
#
# 更改 "e:/usr/apache2.2/cgi-bin" 为你的 scriptalias(脚本别名)。
#
<directory "e:/usr/apache2.2/cgi-bin">
allowoverride none
options none
order allow,deny
allow from all
</directory>

#
# apache parses all cgi scripts for the shebang line by default.
# this comment line, the first line of the script, consists of the symbols
# pound (#) and exclamation (!) followed by the path of the program that
# can execute this specific script. for a perl script, with perl.exe in
# the c:\program files\perl directory, the shebang line should be:
#
# 默认的,apache 将整个行解释为 cgi 脚本。
# 注释行、脚本第一行、带#!的程序路径,都能执行这个指定的脚本。比如一个 perl 脚本,
# 在 c:\program files\perl 中有 perl.exe 解释程序,整个行写为:
#
#!c:/program files/perl/perl

# note you _must_not_ indent the actual shebang line, and it must be the
# first line of the file. of course, cgi processing must be enabled by
# the appropriate scriptalias or options execcgi directives for the files
# or directory in question.
#
# however, apache on windows allows either the unix behavior above, or can
# use the registry to match files by extention. the command to execute
# a file of this type is retrieved from the registry by the same method as
# the windows explorer would use to handle double-clicking on a file.
# these script actions can be configured from the windows explorer view menu,
# 'folder options', and reviewing the 'file types' tab. clicking the edit
# button allows you to modify the actions, of which apache 1.3 attempts to
# perform the 'open' action, and failing that it will try the shebang line.
# this behavior is subject to change in apache release 2.0.
#
# each mechanism has it's own specific security weaknesses, from the means
# to run a program you didn't intend the website owner to invoke, and the
# best method is a matter of great debate.
#
# to enable the this windows specific behavior (and therefore -disable- the
# equivilant unix behavior), uncomment the following directive:
#
#scriptinterpretersource registry
#
# the directive above can be placed in individual <directory> blocks or the
# .htaccess file, with either the 'registry' (windows behavior) or 'script'
# (unix behavior) option, and will override this server default option.
#

#
# defaulttype: 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 images, 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

<ifmodule mime_module>
#
# typesconfig points to the file containing the list of mappings from
# filename extension to 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 application/x-gzip .tgz
#
# addencoding allows you to have certain browsers uncompress
# information on the fly. note: not all browsers support this.
#
#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

# for type maps (negotiated resources):
#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

#添加 .php 文件扩展
addtype application/x-httpd-php .php
</ifmodule>

#
# 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.
#
#mimemagicfile conf/magic

#
# 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 http://www.kysf.net/subscription_info.html
#

#
# enablemmap and enablesendfile: on systems that support it,
# memory-mapping or the sendfile syscall is used to deliver
# files. this usually improves server performance, but must
# be turned off when serving from networked-mounted
# filesystems or if support for these functions is otherwise
# broken on your system.
#
#enablemmap off
#enablesendfile off

# supplemental configuration
#
# the configuration files in the conf/extra/ directory can be
# included to add extra features or to modify the default configuration of
# the server, or you may simply copy their contents here and change as
# necessary.

# 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
#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

# secure (ssl/tls) connections
#include conf/extra/httpd-ssl.conf
#
# note: the following must must be present to support
# starting without ssl on platforms with no /dev/random equivalent
# but a statically compiled-in mod_ssl.
#
<ifmodule ssl_module>
sslrandomseed startup builtin
sslrandomseed connect builtin
</ifmodule>