Apache最新官方配置文件中文版
#
# Based upon the NCSA server configuration files originally by Rob McCool.
#參照NCSA服務(wù)器的配置文件,原版由Rob McCool發(fā)布
#
# This is the main Apache server configuration file. It contains the
# configuration directives that give the server its instructions.
# See URL:http://httpd.apache.org/docs-2.0/> for detailed information about
# the directives.
#這是Apache server的主配置文件. 它包含配置指令,來指示服務(wù)器
#請參考 http://httpd.apache.org/docs-2.0 了解關(guān)于指令的詳細信息
# 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.
#不要僅僅是閱讀本指令,而應(yīng)該理解指令做了什么。在這里僅起提示的作用。
#如果你不清楚請參閱在線文檔。特別提示
# 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的全局操作的指令(全局環(huán)境變量).
# 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.配置主服務(wù)或者默認服務(wù)的指令,它針對那些被虛擬主機以外的請求作出響應(yīng).
# 它也包含虛擬主機的一些默認參數(shù)
# 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. 虛擬主機設(shè)置,這使得發(fā)往不同的ip或者主機名的請求可以被子同一個Apache服務(wù)# 器處理
# 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 "C:/Program Files/Apache Group/Apache2" will be interpreted by the
# server as "C:/Program Files/Apache Group/Apache2/logs/foo.log".
#配置和日志文件名:如果你所指定的文件名以”/”(在Win32中以盤符:/)開頭,服務(wù)器將以絕對路徑來處理。如果不以”/”開頭,則以相對于ServerRoot不解釋,所以對于logs/foo.log來講,當ServerRoot為"C:/Program Files/Apache Group/Apache2”時,則指的是
C:/Program Files/Apache Group/Apache2/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所在的盤符為默認值
建議在絕對路徑中永遠使用顯式的盤符,這樣有助于消除誤解
### Section 1: Global Environment
#第一部分全局環(huán)境
#
# 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服務(wù)器,例如它所能處理的并發(fā)請求數(shù)或者它在哪里能夠找到其配置文件
#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
# ServerRoot: 服務(wù)器的配置,錯誤和日志文件的根目錄
# NOTE! If you intend to place this on an NFS (or otherwise network)
# mounted filesystem then please read the LockFile documentation (available
# at URL:http://httpd.apache.org/docs-2.0/mod/mpm_common.html#lockfile>;
# you will save yourself a lot of trouble.
#注意:如果將其保存到NFS上或者網(wǎng)絡(luò)上mounted的文件系統(tǒng)上,然后應(yīng)該閱讀LockFile文檔,http://httpd.apache.org/docs-2.0/mod/mpm_common.html#lockfile,將能解決你的很多麻煩.
# Do NOT add a slash at the end of the directory path.
#不要在目錄的末尾加上斜杠
ServerRoot "C:/Program Files/Apache Group/Apache2"
ServerRoot:根目錄
#
# ScoreBoardFile: File used to store internal server process information.
# If unspecified (the default), the scoreboard will be stored in an
# anonymous shared memory segment, and will be unavailable to third-party
# applications.
ScoreBoardFile: 保存服務(wù)器內(nèi)部的處理信息
如果未定議(默認狀態(tài)),scoreboard將被保存在匿名的共享內(nèi)存段中,并且對于第三方來講,是不可獲得的
# If specified, ensure that no two invocations of Apache share the same
# scoreboard file. The scoreboard file MUST BE STORED ON A LOCAL DISK.
#如果已定義,應(yīng)確保Apache的兩個調(diào)用不能共享同一個scoreboard. Scoreboard文件必須存放在可分配的磁盤上
#ScoreBoardFile logs/apache_runtime_status
#
# PidFile: The file in which the server should record its process
# identification number when it starts.
#PidFile:當服務(wù)器起努時,服務(wù)器需要將其進程ID號存放在此文件中
PidFile logs/httpd.pid
#
# Timeout: The number of seconds before receives and sends time out.
#Timeout:接收和發(fā)送數(shù)據(jù)的超時設(shè)置,秒數(shù)
Timeout 300
#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#KeepAlive: 是否支持持久聯(lián)接(而不是每個請求建一個連接),設(shè)off關(guān)閉此功能
KeepAlive On
#
# 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:在持久連接期間,所允許的最大請求數(shù)量。設(shè)為0表示不作限制
建議設(shè)為較高的數(shù),以提高性能
MaxKeepAliveRequests 100
#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#KeepAliveTimeout:在同一個客戶連接中,等待下一個請求的等待時間。
KeepAliveTimeout 15
##
## Server-Pool Size Regulation (MPM specific)
## 常規(guī)Server-Pool服務(wù)器池的大小(每分鐘M數(shù))
# WinNT MPM WinNT 的MPM
# ThreadsPerChild: constant number of worker threads in the server process
ThreadPerChild:服務(wù)器進程中工作的線程數(shù)量
# MaxRequestsPerChild: maximum number of requests a server process serves
每個服務(wù)進程的最大請求數(shù)
IfModule mpm_winnt.c>
ThreadsPerChild 250
MaxRequestsPerChild 0
/IfModule>
#
# 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)
#像下面那樣指定偵聽的IP地址,防止Apache搶占所有綁定的IP地址
#Listen 12.34.56.78:80
Listen 80
#
# Dynamic Shared Object (DSO) Support
#動態(tài)共享對象支持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的方式構(gòu)建,你應(yīng)該在下面使用LoadModule行,使得能夠在使用前獲得指令的功能。靜態(tài)編譯模塊(在httpd-1中所列舉的)不需要在此裝載
# Example:
# LoadModule foo_module modules/mod_foo.so
#
LoadModule access_module modules/mod_access.so
LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule asis_module modules/mod_asis.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 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 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 imap_module modules/mod_imap.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_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
#
# 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.
#擴展狀態(tài)控制Apache是否產(chǎn)生完整的狀態(tài)信息(設(shè)為on產(chǎn)生全部),如果設(shè)為Off則產(chǎn)生基本的信息,當與server-status頭有關(guān),默認值為Off
#ExtendedStatus On
### Section 2: 'Main' server configuration
#第二部分:主服務(wù)配置
# 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.
#本節(jié)中指令的設(shè)置值,將被主服務(wù)所使用,主服務(wù)響應(yīng)那些沒有被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.
所有這些指令將出現(xiàn)在VirtualHost>容器中,這些設(shè)定值將在定義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:你的地址,當系統(tǒng)故障時,可以給你發(fā)email。此地址出現(xiàn)在那些由服務(wù)器生成的頁面上,如出錯文檔。例如:admin@your-domain.com
ServerAdmin webmaster@moers.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名稱和端口號,用以標明自己的身份。通??梢宰詣佣x,建議顯式地定義,避免起動時出錯
# If this is not set to valid DNS name for your host, server-generated
# redirections will not work. See also the UseCanonicalName directive.
#如果沒有正確定義主機的DNS,服務(wù)器產(chǎn)生的重定向?qū)⒉粫ぷ?,同時參考UseCanonicalName指令。
# 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.
#如果你沒有注冊DNS名字,請在這里輸入IP地址。
你可以在任何情況下使用ip地址,這也使用得重定向變得敏感
ServerName www.moers.com: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:決定Apaceh如何構(gòu)建自定參考URL,和SERVER_NAME及SERVER_PORT變量
當設(shè)為Off時,Apache將使用客戶端給出的域名和端口。當設(shè)為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:服務(wù)器文檔放置目錄。在默認情形下,所有的請求都從這里開始,除了記號和別名將改指它處以外。
DocumentRoot "C:/Program Files/Apache Group/Apache2/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訪問的目錄,可以配置成允許或禁止哪些服務(wù)和特征(包括其子目錄)
# First, we configure the "default" to be a very restrictive set of
# features.
#首先,我們定義一個默認的非常嚴格的配置
Directory />
Options FollowSymLinks
AllowOverride None
/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.
#注意,從這一點往前,你必須許可某些特殊的功能,所以如果某些功能未能如你所愿,要確保你在在下述中啟用了該功能。
#
# This should be changed to whatever you set DocumentRoot to.
# 這將改變你對DocumentRoot的設(shè)置
Directory "C:/Program Files/Apache Group/Apache2/htdocs">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
可能的值為None,All或者任意組合
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
# 索引包括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.0/mod/core.html#options
# for more information.
#選項指令既復雜又重要,請參閱http://httpd.apache.org/docs-2.0/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,或者組合關(guān)鍵字
AllowOverride None
#
# Controls who can get stuff from this server.
#控制誰可以可以訪問此服務(wù)
Order allow,deny
Allow from all
/Directory>
#
# UserDir: The name of the directory that is appended onto a user's home
# directory if a ~user request is received. Be especially careful to use
# proper, forward slashes here. On Windows NT, "Personal/My Website"
# is a more appropriate choice.
# UserDir: 用戶的home的名稱,當接到到~user的請求時。
請小心正確使用”/”. 在WinNT上,”Personal/My Website”是更合適的選擇
UserDir "My Documents/My Website"
#
# Control access to UserDir directories. The following is an example
# for a site where these directories are restricted to read-only.
#控制UserDir目錄,以下是一個例子,這個目錄是只讀的
# You must correct the path for the root to match your system's configured
# user directory location, e.g. "C:/WinNT/profiles/*/My Documents/My Website"
# or whichever, as appropriate.
#你必須更正root目錄,與系統(tǒng)設(shè)置相配,如用戶目錄是C:/WinNT/profiles/*/My Documents/My Website或者其它合適的
#Directory "C:/Documents and Settings/*/My Documents/My Website">
# AllowOverride FileInfo AuthConfig Limit
# Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
# Limit GET POST OPTIONS PROPFIND>
# Order allow,deny
# Allow from all
# /Limit>
# LimitExcept GET POST OPTIONS PROPFIND>
# Order deny,allow
# Deny from all
# /LimitExcept>
#/Directory>
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#DirectoryIndex: Apache服務(wù)器將要以一個目錄的形式響應(yīng)服務(wù)
# 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.
#index.html變量文件(一種映射)將直接傳送內(nèi)容。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: 用來查找各個目錄下額外的配置指令的配置文件名,同時參考AllowOverride(允許重載)指令
#Acce
AccessFileName .htaccess
#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#下面兩行,阻址Web客戶端訪問 .htaccess和htpasswd(訪問設(shè)定和密碼)的文件
#
Files ~ "^\.ht">
Order allow,deny
Deny from all
/Files>
#
# TypesConfig describes where the mime.types file (or equivalent) is
# to be found.
# TypesConfig,描述在何處找到mime型別
TypesConfig 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.
如果服務(wù)器不能確定文檔的型別,將使用默認的MIME型別,例如根據(jù)擴展名
# 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.
#如果你的服務(wù)器主要包括text/html文檔,”text/plain”就是一個好的取值。如果你的大多數(shù)內(nèi)容是binary(二進制)的,如應(yīng)用程序或圖片,你可能希望使用application/octet-stream,使得瀏覽器試圖顯示二進制數(shù)據(jù),盡管它們是文本
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.
# mod_mime_magic模塊,允許服務(wù)器根據(jù)內(nèi)容提示來識別文件型別。MIMEMagicFile指令告知模塊“內(nèi)容提示”應(yīng)到何處找。
IfModule mod_mime_magic.c>
MIMEMagicFile conf/magic
/IfModule>
#
# HostnameLookups: Log the names of clients or just their IP addresses
# e.g., www.apache.org (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: 客戶日志或者僅其IP地址,如www.apache.org(on) 或者204.62.129.132
(off).默認為值設(shè)為off比較好,如果希望將此置為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
# http://httpd.apache.org/docs-2.0/mod/core.html#enablemmap
# EnableMMAP: 控制是否通過內(nèi)存映射的方式傳送文件(須得操作系統(tǒng)支持)
默認值為on; 如果你使用NSF加載的文件系統(tǒng)(通常在linux下),應(yīng)置為off. 在某些系統(tǒng)上,置off,不管使用什么文件系統(tǒng),能夠提高效率,詳細情況,請參閱文檔
#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
# http://httpd.apache.org/docs-2.0/mod/core....#enablesendfile
# EnableSendfile: 控制內(nèi)核傳送文件是否支持(需要OS支持)。默認為on,如果使用NFS,則使用off
#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: 出錯日志文件
如果你想為虛擬主機定義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.
# LogLever: 日志等級,(與log4j相似,譯者注),決定哪些級別的出錯信息將被記錄,如debug,info,notice,warn,error, crit,alert,emerg等,在設(shè)定級別以上的信息就會被記錄(譯者注).
LogLevel warn
#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
# 日志格式(與log4j相似)
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
# You need to enable mod_logio.c to use %I and %O
#LogFormat "%h %l %u %t \&;%r\&; %>s %b \&;%{Referer}i\&; \&;%{User-Agent}i\&; %I %O" combinedio