文章簡介:apache最新官方配置文件中文版。幫忙web服務器管理員更方便的對apache進行配置。
#
# based upon the ncsa server configuration files originally by rob mccool.
#參照ncsa服務器的配置文件,原版由rob mccool發布
#
# 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的主配置文件. 它包含配置指令,來指示服務器
#請參考 http://httpd.apache.org/docs-2.0 了解關于指令的詳細信息
# 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 "c:/program files/apache group/apache2" will be interpreted by the
# server as "c:/program files/apache group/apache2/logs/foo.log".
#配置和日志文件名:如果你所指定的文件名以”/”(在win32中以盤符:/)開頭,服務器將以絕對路徑來處理。如果不以”/”開頭,則以相對于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
#第一部分全局環境
#
# 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服務器,例如它所能處理的并發請求數或者它在哪里能夠找到其配置文件
#
# 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:http://httpd.apache.org/docs-2.0/mod/mpm_common.html#lockfile>);
# you will save yourself a lot of trouble.
#注意:如果將其保存到nfs上或者網絡上mounted的文件系統上,然后應該閱讀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: 保存服務器內部的處理信息
如果未定議(默認狀態),scoreboard將被保存在匿名的共享內存段中,并且對于第三方來講,是不可獲得的
# if specified, ensure that no two invocations of apache share the same
# scoreboard file. the scoreboard file must be stored on a local disk.
#如果已定義,應確保apache的兩個調用不能共享同一個scoreboard. scoreboard文件必須存放在可分配的磁盤上
#scoreboardfile logs/apache_runtime_status
#
# pidfile: the file in which the server should record its process
# identification number when it starts.
#pidfile:當服務器起努時,服務器需要將其進程id號存放在此文件中
pidfile logs/httpd.pid
#
# timeout: the number of seconds before receives and sends time out.
#timeout:接收和發送數據的超時設置,秒數
timeout 300
#
# keepalive: whether or not to allow persistent connections (more than
# one request per connection). set to "off" to deactivate.
#keepalive: 是否支持持久聯接(而不是每個請求建一個連接),設off關閉此功能
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:在持久連接期間,所允許的最大請求數量。設為0表示不作限制
建議設為較高的數,以提高性能
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)
## 常規server-pool服務器池的大小(每分鐘m數)
# winnt mpm winnt 的mpm
# threadsperchild: constant number of worker threads in the server process
threadperchild:服務器進程中工作的線程數量
# maxrequestsperchild: maximum number of requests a server process serves
每個服務進程的最大請求數
<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
#動態共享對象支持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-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.
#擴展狀態控制apache是否產生完整的狀態信息(設為on產生全部),如果設為off則產生基本的信息,當與server-status頭有關,默認值為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.
#本節中指令的設置值,將被主服務所使用,主服務響應那些沒有被<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. [email protected]
# serveradmin:你的地址,當系統故障時,可以給你發email。此地址出現在那些由服務器生成的頁面上,如出錯文檔。例如:[email protected]
serveradmin [email protected]
#
# 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 this is not set to valid dns name for your host, server-generated
# redirections will not work. see also the usecanonicalname directive.
#如果沒有正確定義主機的dns,服務器產生的重定向將不會工作,同時參考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如何構建自定參考url,和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:服務器文檔放置目錄。在默認情形下,所有的請求都從這里開始,除了記號和別名將改指它處以外。
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訪問的目錄,可以配置成允許或禁止哪些服務和特征(包括其子目錄)
# 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的設置
<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,或者組合關鍵字
allowoverride none
#
# controls who can get stuff from this server.
#控制誰可以可以訪問此服務
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目錄,與系統設置相配,如用戶目錄是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服務器將要以一個目錄的形式響應服務
# 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變量文件(一種映射)將直接傳送內容。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(訪問設定和密碼)的文件
#
<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.
如果服務器不能確定文檔的型別,將使用默認的mime型別,例如根據擴展名
# 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.
#如果你的服務器主要包括text/html文檔,”text/plain”就是一個好的取值。如果你的大多數內容是binary(二進制)的,如應用程序或圖片,你可能希望使用application/octet-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.
# mod_mime_magic模塊,允許服務器根據內容提示來識別文件型別。mimemagicfile指令告知模塊“內容提示”應到何處找。
<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).默認為值設為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: 控制是否通過內存映射的方式傳送文件(須得操作系統支持)
默認值為on; 如果你使用nsf加載的文件系統(通常在linux下),應置為off. 在某些系統上,置off,不管使用什么文件系統,能夠提高效率,詳細情況,請參閱文檔
#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.html#enablesendfile
# enablesendfile: 控制內核傳送文件是否支持(需要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等,在設定級別以上的信息就會被記錄(譯者注).
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
新聞熱點
疑難解答