Apache服務器主配置文件httpd.conf詳解
apache 2.2
# 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.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服務器配置文件。 # 它給服務器指示配置指令。 # 可去http://httpd.apache.org/docs/2.2/查看詳細信息 # 特別情況可去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'). # 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. 'main'或者'default'服務器參數(shù)定義,# 這些參數(shù)響應非虛擬主機的操作請求。同時也為所以虛擬主機提供了默認設定值。# 3. 設置虛擬主機,可以通過一個Apache服務器來實現(xiàn)處理不同IP或者主機名的Web請求。 # 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的“drive:/”開頭,來指定服務器的控制文件名,服務器將使用顯式路徑。# 如果未用“/”開頭,比如文件名“l(fā)ogs/foo.log”,假設服務器根目錄為“/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. ### 章節(jié)1:全局環(huán)境# 這節(jié)的指令影響Apache的整體操作,比如它能操作的當前連接請求數(shù)目或者去哪里# 查找其配置文件等。 # Don't give away too much information about all the subcomponents # we are running. Comment out this line if you don't mind remote sites # finding out what major optional modules you are running ServerTokens OS # 不要泄漏太多的服務器信息。# 如果不想讓遠程站點了解到你的主要選型模塊信息,可以注釋掉該行。 # ServerRoot: The top of the directory tree under which the server's # configuration, error, and log files are kept. # # 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.2/mod/mpm_common.html#lockfile>); # you will save yourself a lot of trouble. # # Do NOT add a slash at the end of the directory path. # ServerRoot "/etc/httpd" # 服務器的根:目錄樹的頂部,其下存放著配置、錯誤,以及日志文件等。## 注意!如果你打算將它放到掛載文件系統(tǒng)的NFS(或者其他網(wǎng)絡),建議參閱LockFile文檔# (有效鏈接為http://httpd.apache.org/docs/2.2/mod/mpm_common.html#lockfile)# 你將省去不少麻煩。# # 不要在目錄的末尾加斜線“/”# ServerRoot "/etc/httpd" # PidFile: The file in which the server should record its process # identification number when it starts. # PidFile run/httpd.pid # Pid文件:當進程啟動時,服務器應當在其中記錄PID。# PidFile run/httpd.pid # # Timeout: The number of seconds before receives and sends time out. # Timeout 120 # Timeout:確定發(fā)送超時和接收超時的秒數(shù)。Timeout 120 # # KeepAlive: Whether or not to allow persistent connections (more than # one request per connection). Set to "Off" to deactivate. # KeepAlive Off # KeepAlive:是否允許保持連接狀態(tài)(每次連接可以執(zhí)行多個請求)。一般設置為“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:持續(xù)連接最大數(shù)。0表示無限數(shù)量。# 為了最大性能,推薦將其設置高一點。MaxKeepAliveRequests 100 # # KeepAliveTimeout: Number of seconds to wait for the next request from the # same client on the same connection. # KeepAliveTimeout 15 # KeepAliveTimeout:同一客戶端同一連接請求的間隔秒數(shù)。KeepAliveTimeout 15 ## ## Server-Pool Size Regulation (MPM specific) ## ## 服務器池大小調整(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(預分離多進程模塊)# StartServices:服務器啟動進程數(shù)# MinSpareServers:最小空閑進程數(shù)# MaxSpareServers:最大空閑進程數(shù)# ServerLimit:最大進程數(shù)MaxClients時,服務器的最大生存時間值# MaxClients:服務器運行啟動的最大進程數(shù)量# MaxRequestPerChild:每個服務子進程的最大請求數(shù)量<IfModule prefork.c>StartServers 8MinSpareServers 5MaxSpareServers 20ServerLimit 256MaxClients 256MaxRequestsPerChild 4000</IfModule> # 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 多進程模塊# StartServers:服務器啟動進程的初始化數(shù)目# MaxClients:同時客戶端連接的最大數(shù)目# MinSpareThreads:最小空閑worker線程數(shù)# MaxSpareThreads:最大空閑worker線程數(shù)# ThreadsPerChild:每個服務器子進程的worker線程數(shù)# MaxRequestsPerChild:每個子進程的最大請求數(shù)<IfModule worker.c>StartServers 2MaxClients 150MinSpareThreads 25MaxSpareThreads 75ThreadsPerChild 25MaxRequestsPerChild 0</IfModule> # # 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地址和/或端口。也可# 查看<VirtualHost>指令。# # 如下設置特定IP地址,可防止Apache接收所有綁定的IP(0.0.0.0)# 默認接收所有IP,特定IP的Listen被“#”注釋掉#Listen 12.34.56.78:80Listen 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 # # # 動態(tài)共享對象(DSO)支持# # 為了能使用編譯為DSO的模塊函數(shù),我們必須將相應的‘LoadModule'行放在此處,這樣模塊中的指令將有效。# 靜態(tài)編譯模塊(用‘httpd -l'命令可以列出)不需要在這里加載。# # 示例:# LoadModule foo_module modules/mod_foo.so# LoadModule auth_basic_module modules/mod_auth_basic.so LoadModule auth_digest_module modules/mod_auth_digest.so LoadModule authn_file_module modules/mod_authn_file.so LoadModule authn_alias_module modules/mod_authn_alias.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 authz_host_module modules/mod_authz_host.so LoadModule authz_user_module modules/mod_authz_user.so LoadModule authz_owner_module modules/mod_authz_owner.so LoadModule authz_groupfile_module modules/mod_authz_groupfile.so LoadModule authz_dbm_module modules/mod_authz_dbm.so LoadModule authz_default_module modules/mod_authz_default.so LoadModule ldap_module modules/mod_ldap.so LoadModule authnz_ldap_module modules/mod_authnz_ldap.so LoadModule include_module modules/mod_include.so LoadModule log_config_module modules/mod_log_config.so LoadModule logio_module modules/mod_logio.so LoadModule env_module modules/mod_env.so LoadModule ext_filter_module modules/mod_ext_filter.so LoadModule mime_magic_module modules/mod_mime_magic.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 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 actions_module modules/mod_actions.so LoadModule speling_module modules/mod_speling.soLoadModule userdir_module modules/mod_userdir.soLoadModule alias_module modules/mod_alias.soLoadModule rewrite_module modules/mod_rewrite.soLoadModule proxy_module modules/mod_proxy.soLoadModule proxy_balancer_module modules/mod_proxy_balancer.soLoadModule proxy_ftp_module modules/mod_proxy_ftp.soLoadModule proxy_http_module modules/mod_proxy_http.soLoadModule proxy_connect_module modules/mod_proxy_connect.soLoadModule cache_module modules/mod_cache.soLoadModule suexec_module modules/mod_suexec.soLoadModule disk_cache_module modules/mod_disk_cache.soLoadModule file_cache_module modules/mod_file_cache.soLoadModule mem_cache_module modules/mod_mem_cache.soLoadModule cgi_module modules/mod_cgi.soLoadModule version_module modules/mod_version.so## The following modules are not loaded by default:##LoadModule cern_meta_module modules/mod_cern_meta.so#LoadModule asis_module modules/mod_asis.so # # Load config files from the config directory "/etc/httpd/conf.d". # Include conf.d/*.conf # 從config目錄“/etc/httpd/conf.d”加載配置文件# *.conf兼容老版本的ApacheInclude 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是否產(chǎn)生“full”狀態(tài)信息(On)或者# 基本信息(Off)。默認為Off。##ExtendedStatus On # # 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來運行httpd,它會切換到其他用戶或組去。# # 用戶/組:作為運行httpd的用戶/組的名稱。# - 在SCO(ODT 3)上,使用“User nouser”和“Group nogroup”。# - 在HPUX上,將無法使用共享存儲作為nobody,建議的解決辦法是創(chuàng)建一個用戶www并使用這個用戶。# 注意,有的內核不支持60000以上的組ID值,在這些系統(tǒng)中不要使用“Group #-1”。# User apacheGroup apache ### 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. # ### 章節(jié)2:‘Main'服務器配置# # 該章節(jié)設置‘Main'服務器使用的指令,響應所有非<VirtualHost>定義的請求。# 這些指令值也為<VirtualHost>部分提供默認值。# # 所有這些指令都可以在<VirtualHost>段中出現(xiàn),此時,這些默認值將被虛擬主機的相關設置值所覆蓋。 # # 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 root@localhost # ServerAdmin:服務器管理員的郵箱地址,該地址一般出現(xiàn)在服務器生成頁中,比如錯誤文檔等。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 www.example.com:80 # ServerName 給出一個服務器用來標識它自己的名稱和端口。# 通常被自動指定,但為避免啟動時的問題,推薦明確指定它。# # 如果主機沒有設置有效的DNS名稱,server-generated指令將不會工作。# # 如果主機沒有注冊DNS,輸入其IP地址。這樣就可以通過IP地址訪問你的主機了。# #ServerName www.example.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 Off # UseCanonicalName:確定apache如何構建自引用URLs和SERVER_NAME、SERVER_PORT變量。# 當設為Off時,apache將使用客戶端支持的Hostname和Port。當設為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存取的目錄(包括子目錄)都可配置為允許和禁止。# # 首先,我們配置嚴格特征集合的默認值。# <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. # # 注意,從此點開始,必須指定使能特殊特性的允許。所以,如果一些事情沒有安裝你的期望的運行,# 確保你已經(jīng)指定并使能以下特性。 # # This should be changed to whatever you set DocumentRoot to. # <Directory "/var/www/html"> # 這里應當根據(jù)你設定的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 # http://httpd.apache.org/docs/2.2/mod/core.html#options # for more information. # Options Indexes FollowSymLinks # 指令選項值可以是“None”、“All”,或者下面的任何組合:# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews# # 注意,“MultiViews”必須被清楚地指定---“All”不會幫你指定。# # 指令選項復雜并且重要。詳細信息請查閱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 None # AllowOverride 允許優(yōu)先,用來控制哪些指令可以放到.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</Directory> # # 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: http://httpd.apache.org/docs/misc/FAQ.html#forbidden # <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> # UserDir:當接收到~user請求時,附加到用戶home目錄上的目錄名稱。# # 端用戶賬戶路徑‘public_html'路徑對web服務器用戶id必須是可存取的。# 這通常意味著~userid必須擁有711權限值,~userid/public_html必須有755權限值,# 并且其中包含的文件都是公開的。否則,客戶端只能收到“403 Forbidden”消息。# # 可查閱:http://httpd.apache.org/docs/misc/FAQ.html#forbidden# <IfModule mod_userdir.c> # UserDir默認被禁止掉,這樣可以確定一個系統(tǒng)用戶名的存在(依賴home路徑許可)。 UserDir disable # 要使能/~user/請求以提供用戶的public_html目錄的話,刪除上面的“UserDir disable”行, # 并且取消下面的注釋: #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> # UserDir目錄的存取控制。以下是一個這些目錄被限制到只讀的站點示例。# #<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文件用來傳遞內容協(xié)商了的文檔。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客戶端查看。<Files ~ "^\.ht"> Order allow,deny Deny from all</Files> # # TypesConfig describes where the mime.types file (or equivalent) is # to be found. # TypesConfig /etc/mime.types # TypesConfig 描述了mime.types文件在哪TypesConfig /etc/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 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 # DefaultType 是服務器無法從文件擴展名確定文檔類型時,將使用的默認MIME類型。# 如果你的服務器大部分都是text和html文檔,“text/plain”是一個合適值。# 如果你的服務器大部分都是二進制文檔,“application/octet-stream”可避免服務器嘗試用text來顯示二進制。#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模塊允許服務器從文件內容來確定文件類型。# MIMEMagicFile指令告訴該模塊隱含文件類型信息的位置。<IfModule mod_mime_magic.c># MIMEMagicFile /usr/share/magic.mime 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 Off # HostnameLookups:將客戶端名稱或其IP地址加入日志。# 默認為off對整個網(wǎng)絡比較好,如果有人明知卻非要打開這個特性,那么使能它意味著每個客戶端請求都將# 導致至少一個域名服務器查詢請求。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.2/mod/core.html#enablemmap # #EnableMMAP off # EnableMMAP:存儲器鏡像文件傳輸控制(需要操作系統(tǒng)的支持)。# 默認為on;如果從NFS-mounted文件系統(tǒng)提供文件則設為off。# 有些系統(tǒng),設為off(不考慮文件系統(tǒng))能提高性能;詳情請# 查閱http://httpd.apache.org/docs/2.2/mod/core.html#enablemmap# #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.2/mod/core.html#enablesendfile # #EnableSendfile off # EnableSendfile:文件傳輸內核使能控制(需要系統(tǒng)支持)。# 默認為on;如果從NFS-mounted文件系統(tǒng)提供文件則設為off。# 請查閱http://httpd.apache.org/docs/2.2/mod/core.html#enablesendfile# #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:錯誤日志文件的位置。# 如果不在<VirtualHost>段中指定錯誤日志指令,虛擬主機的錯誤日志信息也會記錄到這個文件。# 如果在<VirtualHost>段中指定錯誤日志指令,則此虛擬主機的錯誤將會在那里記錄而不在該文件記錄。# 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:控制什么級別的信息被記錄到error_log日志文件中。# 可能的值包括: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\"" combine d LogFormat "%h %l %u %t \"%r\" %>s %b" common LogFormat "%{Referer}i -> %U" referer LogFormat "%{User-agent}i" agent # "combinedio" includes actual counts of actual bytes received (%I) and sent (%O); this # requires the mod_logio module to be loaded. #LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio # 下面的指令,為CustomLog指令定義了一些昵稱。# “combinedio”包含實際接收和發(fā)送字節(jié)的實際計數(shù);這需要加載mod_logio模塊。 # # 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 # 普通日志文件的位置和格式。# 若在<VirtualHost>段中定義該指令,則其普通日志文件不會存在該文件中。# #CustomLog logs/access_log common # # If you would like to have separate agent and referer logfiles, uncomment # the following directives. # #CustomLog logs/referer_log referer #CustomLog logs/agent_log agent # 若是想分離代理和引用日志文件,則取消下面指令的注釋。# #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 # 若是不想用分離代理和引用日志文件,則用下面的指令:# 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 # 可選地添加一行包含服務器版本和虛擬主機名稱信息到服務器生成的頁中(內部錯誤文檔、FTP目錄列表、mod_status和# mod_info輸出等,但非CGI生成文檔或者自定義錯誤文檔)。# 設置為“EMail”也包含mailto管理員郵箱的鏈接。# 可設置為其中之一: On | Off | EMail# ServerSignature On # # Aliases: Add here as many aliases as you need (with no limit). The format is # Alias fakename realname # # 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. # # 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> # Aliases:在此添加無限個你需要的別名。# 格式為 Alias 別名 真名# 注意,如果別名中以“/”結尾,則服務器將要求“/”出現(xiàn)在URL中。# 別名中有“/”,則真名中必須有“/”。反之亦然。# # # WebDAV module configuration section. # <IfModule mod_dav_fs.c> # Location of the WebDAV lock database. DAVLockDB /var/lib/dav/lockdb </IfModule> # WebDAV模塊配置部分。# WebDAV鎖定數(shù)據(jù)庫的位置設置。 # # 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:服務器腳本目錄別名。# 腳本目錄存放服務器響應請求時執(zhí)行的應用程序,而非發(fā)送給客戶端的文件。# “/”的處理跟Alias相同。# ScriptAlias /cgi-bin/ “/var/www/cgi-bin/” # # "/var/www/cgi-bin" should be changed to whatever your ScriptAliased # CGI directory exists, if you have that configured. # <Directory "/var/www/cgi-bin"> AllowOverride None Options None Order allow,deny Allow from all </Directory> # “/var/www/cgi-bin”應當對應到你自己的CGI路徑,如果你需要該配置。 # # 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 http://www.example.com/bar # 重定向允許你告訴客戶端曾經(jīng)在你空間中使用的文檔已經(jīng)不存在了。通知客戶端去什么位置查找文檔。 # # Directives controlling the display of server-generated directory listings. # # # 服務器生成路徑列表顯示的控制指令# # # IndexOptions: Controls the appearance of server-generated directory # listings. # IndexOptions FancyIndexing VersionSort NameWidth=* HTMLTable # IndexOptions:服務器生成目錄列表的索引控制。IndexOptions FancyIndexing VersionSort NameWidth=* HTMLTable # # 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/image2.gif) image/* AddIconByType (SND,/icons/sound2.gif) audio/* AddIconByType (VID,/icons/movie.gif) video/* ............ ............ ............ # AddIcon* 指令使服務器對不同文件顯示不同的文件類型圖標。 # # 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 允許你對在服務器生成文件索引后面加入對某類文件的簡短描述。# #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
老版本
#
# Apache服務器主配置文件. 包括服務器指令的目錄設置.
# 詳見 <URL:http://www.apache.org/docs/>
#
# 請在理解用途的基礎上閱讀各指令。
#
# 再讀取此文檔后,服務器將繼續(xù)搜索運行
# E:/Program Files/Apache Group/Apache/conf/srm.conf
# E:/Program Files/Apache Group/Apache/conf/access.conf
# 除非用ResourceConfig或AccessConfig覆蓋這兒的標識
#
# 配置標識由三個基本部分組成:
# 1. 作為一個整體來控制Apache服務器進程的標識 (the 'global environment').
# 2. 用于定義主(默認)服務器參數(shù)的標識。
# 響應虛擬主機不能處理的請求。
# 同時也提供所有虛擬主機的設置值。
# 3. 虛擬主機的設置。在一個Apache服務器進程中配置不同的IP地址和主機名。
#
# 配置和日志文件名:指定服務器控制文件命名時,
# 以 "/" (或 "drive:/" for Win32)開始,服務器將使用這些絕對路徑。
# 如果文件名不是以"/"開始的,預先考慮服務器根目錄--
# 因此 "logs/foo.log",如果服務器根目錄是"/usr/local/apache",
# 服務器將解釋為 "/usr/local/apache/logs/foo.log".
#
# 注: 指定的文件名需要用"/"代替"\"。
# (例, "c:/apache" 代替 "c:\apache").
# 如果省略了驅動器名,默認使用Apache.exe所在的驅動器盤符
# 建議指定盤符,以免混亂。
#
### 部分 1: 全局環(huán)境
#
# 本部分的表示將影響所有Apache的操作
# 例如,所能處理的并發(fā)請求數(shù)或配置文件地址
#
#
# ServerType 可取值 inetd 或 standalone. Inetd 只適用于Unix平臺
#
ServerType standalone
#
# ServerRoot: 目錄樹的根結點。服務器配置、出錯信息、日志文件都保存在根目錄下。
#
# 不要再目錄末尾加"/"
#
ServerRoot "C:/Program Files/Apache Group/Apache"
#
# PidFile: 服務器用于記錄啟動時進程ID的文件。
#
PidFile logs/httpd.pid
#
# ScoreBoardFile: 用于保存內部服務器進程信息的文件。
# 并非必須。 但是如果指定了(此文件當運行Apache時生成)
# 那么必須確保沒有兩個Apache進程共享同一個scoreboard文件。
#
ScoreBoardFile logs/apache_runtime_status
#
# 在標準配置下,服務器將順序讀取 httpd.conf(此文件可通過命令行中-f參數(shù)指定),
# srm.conf 和 access.conf。
# 目前后兩個文件是空的。為了簡單起見,建議將所有的標識放在一個文件中。
# 以下兩條注釋的標識,是默認設置。
# 要讓服務器忽略這些文件可以用 "/dev/null" (for Unix)
# 或"nul" (for Win32) 作為參數(shù)。
#
#ResourceConfig conf/srm.conf
#AccessConfig conf/access.conf
#
# Timeout: 接受和發(fā)送timeout的時間
#
Timeout 300
#
# KeepAlive: 是否允許保持連接(每個連接有多個請求)
# "Off" -無效
#
KeepAlive On
#
# MaxKeepAliveRequests: 每個連接的最大請求數(shù)。
# 設置為0表示無限制
# 建議設置較高的值,以獲得最好的性能。
#
MaxKeepAliveRequests 100
#
# KeepAliveTimeout: 同一連接同一客戶端兩個請求之間的等待時間。
#
KeepAliveTimeout 15
#
# 在Win32下,Apache每次產(chǎn)生一個子進程來處理請求。
# 如果這個進程死了,會自動產(chǎn)生另一個子進程。
# 所有的進入請求在子進程中多線程處理。
# 以下兩個標識控制進程的運行
#
#
# MaxRequestsPerChild: 每個子進程死亡之前最大請求數(shù)
# 如果超過這個請求數(shù),子程序會自動退出,避免延期使用導致內存溢出或其他問題。
# 大部分系統(tǒng),并不需要此設置,
# 但是部分,象Solaris,確實值得注意。
# 對Win32, 可設置為0 (無限制)
# 除非有另外的考慮。
#
# 注: 此值不包括在每個連接初始化請求后,"keptalive"請求
# 例如, 如果一個子進程處理一個初始化請求和10個后續(xù)"keptalive"請求,
# 在這個限制下,只會記為一個請求。
#
MaxRequestsPerChild 0
#
# ThreadsPerChild: 服務器所允許的并發(fā)線程數(shù)。
# 此值的設置取決于服務器的響應能力(約多的請求在同一時間激活,則每個請求的處理時間越慢)
# 和服務器所允許消耗的系統(tǒng)資源。
#
ThreadsPerChild 50
#
# Listen: 允許將Apache綁頂?shù)街付ǖ腎P地址和端口,作為默認值的輔助選項。
# 參見 <VirtualHost>
#
#Listen 3000
#Listen 12.34.56.78:80
#
# BindAddress: 通過此選項可支持虛擬主機。
# 此標識用于告訴服務器監(jiān)聽哪個IP地址。
# 包括:"*", IP地址, 或域名.
# 參見 <VirtualHost> 和 Listen directives.
#
BindAddress 166.111.178.144
#
# Apache模塊編譯成標準的Windows結構。
#
# 以下模塊綁定到標準的Apache二進制windows分布。
# 要修改標準操作,取消以下行的注釋并且修改指定模塊列表。
#
# 警告:這是高級選項??赡軐е路掌鞅罎?。
# 沒有專家的指導,不要輕易修改。
#
#ClearModuleList
#AddModule mod_so.c mod_mime.c mod_access.c mod_auth.c mod_negotiation.c
#AddModule mod_include.c mod_autoindex.c mod_dir.c mod_cgi.c mod_userdir.c
#AddModule mod_alias.c mod_env.c mod_log_config.c mod_asis.c mod_imap.c
#AddModule mod_actions.c mod_setenvif.c mod_isapi.c
#
# 動態(tài)共享對象(Dynamic Shared Object,DSO)
#
# 要使用基于DSO的功能模塊,需要替換此處相應的
# `LoadModule' 行。這樣在使用之前這些包含的標識都將生效。
# 有關DSO及至的詳細資料請看Apache1.3版中的README.DSOSO。
# 運行"apche -l"將列表顯示Apache內奸的模塊(類似標準的連接已經(jīng)生效)
#
# 注:模塊載入的順序很重要。沒有專家的建議,不要修改以下的順序。
#
#LoadModule anon_auth_module modules/ApacheModuleAuthAnon.dll
#LoadModule dbm_auth_module modules/ApacheModuleAuthDBM.dll
#LoadModule digest_auth_module modules/ApacheModuleAuthDigest.dll
#LoadModule cern_meta_module modules/ApacheModuleCERNMeta.dll
#LoadModule digest_module modules/ApacheModuleDigest.dll
#LoadModule expires_module modules/ApacheModuleExpires.dll
#LoadModule headers_module modules/ApacheModuleHeaders.dll
#LoadModule proxy_module modules/ApacheModuleProxy.dll
#LoadModule rewrite_module modules/ApacheModuleRewrite.dll
#LoadModule speling_module modules/ApacheModuleSpeling.dll
#LoadModule info_module modules/ApacheModuleInfo.dll
#LoadModule status_module modules/ApacheModuleStatus.dll
#LoadModule usertrack_module modules/ApacheModuleUserTrack.dll
#
# ExtendedStatus 在服務器狀態(tài)句柄被呼叫時控制是產(chǎn)生“完整”的狀態(tài)信息(ExtendedStatus On)
# 還是僅返回基本信息(ExtendedStatus Off)
# 默認是:Off
#
#ExtendedStatus On
### 部分 2: 主服務器配置
#
# 此部分的標識用于主服務器所有的設置值,
# 響應任何<VirtualHost>定義不處理的請求
# 這些值同時給你稍后在此文件中定義的<VirtualHost>提供默認值。
#
# 所有的標識可能會在<VirtualHost>中出現(xiàn)。
# 對應的默認值會被虛擬主機重新定義覆蓋。
#
#
# Port: Standalone服務器監(jiān)聽的端口。
# 在Apache能夠監(jiān)聽指定端口前,需要在防火墻中進行設置。
# 其它運行httpd的服務器也可能影響此端口。 Disable
# 如果遇到問題,請關閉所有的防火墻、安全保護和其他的服務。
# Windos NT的"NETSTAT -a"指令會有助于問題的分析。
#
Port 80
#
# ServerAdmin: 你的地址。如果服務器有任何問題將發(fā)信到這個地址。
# 這個地址會在服務器產(chǎn)生的某些頁面中出現(xiàn),例如,錯誤報告。
#
ServerAdmin chenyl98@mails.tsinghua.edu.cn
#
# ServerName 允許設置主機名。如果與程序獲得的不同,主機名將返回客戶端。
# (例如,用"www"代替主機真實的名字)
#
# 注: 主機名不能隨便指定。必須是你的機器有效的DNS名稱。否則無法正常工作。
# 如果不能理解,傾向你的網(wǎng)絡管理員詢問。
# 如果你的主機沒有注冊DNS名,可在此輸入IP地址。
# 此時必須用IP地址來訪問。(如, http://123.45.67.89/)
# 這樣扔可以完成重新定向的工作。
#
# 127.0.0.1 是TCP/IP的本地環(huán)路地址, 通常命名為localhost.
# 機器默認此地置為本身。 如果只是使用Apache來進行本地測試和開發(fā),
# 可使用127.0.0.1 作為服務器名.
#
#ServerName new.host.name
#
# DocumentRoot: 放置服務文檔的目錄。
# 默認狀態(tài)下,所有的請求都以這個目錄為基礎。
# 但是直接符號連接和別名可用于指向其他位置。
#
DocumentRoot "D:/www_root"
#
# Apache訪問的每個目錄可設置相關的服務和特性是允許或(和)不允許。
# (同樣影響其子目錄)
#
# 首先,設置"default"地址只有最基本的權限。
#
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
#
# 注意從現(xiàn)在開始必須制定開啟特殊的權限。
# 這樣就不會產(chǎn)生意想不到的結果。
# 請仔細確認。
#
#
# 這個地址應與DocumentRoot保持一致
#
<Directory "D:/www_root">
#
# 此值可是: "None", "All", 或下列的組合: "Indexes",
# "Includes", "FollowSymLinks", "ExecCGI", 或 "MultiViews".
#
# 注意"MultiViews"必須明確指定--- "Options All"不包括此特性。
#
Options Indexes FollowSymLinks MultiViews
#
# 此項控制目錄中哪些.htaccess文件可覆蓋。
# 允許值: "All"或者以下項的組合:"Options", "FileInfo",
# "AuthConfig", "Limit"
#
AllowOverride None
#
# 控制哪些用戶可從此服務器獲得資料。
#
Order allow,deny
Allow from all
</Directory>
#
# UserDir: 當請求~user時,追加到用戶主目錄的路徑地址。
#
# 在Win32下,并不要求指定為用戶登陸的主目錄。
# 因此可使用以下的格式。
# 詳細參照文檔UserDir
#
<IfModule mod_userdir.c>
UserDir "f:/homepages/"
</IfModule>
#
# 控制訪問UserDir目錄. The following is an example
# 以下是一個站點的例子,權限限制為只讀。
#
#<Directory "E:/Program Files/Apache Group/Apache/users">
# 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: 預設的HTML目錄索引文件名。
# 用空格來分隔多個文件名。
#
<IfModule mod_dir.c>
DirectoryIndex index.html
</IfModule>
#
# AccessFileName: 每個目錄中用于控制訪問信息的文件名。
#
AccessFileName .htaccess
#
# 以下行防止客戶端可訪問 .htaccess 文件。
# 因為 .htaccess文件通常包含授權信息,
# 處于安全的考慮不允許訪問。
# 如果想讓訪客看到.htaccess文件的內容,
# 可將這些行注釋。
# 如果修改了上面的AccessFileName,
# 請在此進行相應的修改。
#
# 同時,一般會用類似.htpasswd的文件保存密碼。
# 這些文件同樣可以得到保護。
#
<Files ~ "^\.ht">
Order allow,deny
Deny from all
</Files>
#
# CacheNegotiatedDocs: 默認下,Apache對每個文檔發(fā)送"Pragma: no-cache"
# 這將要求代理服務器不緩存此文檔。
# 取消下列行的可取消這個屬性,這樣代理服務器將緩存這些文檔。
#
#CacheNegotiatedDocs
#
# UseCanonicalName: (1.3新增) 當此設置為on時,
# 無論何時Apache需要構建一個自引用的URL(指向響應來源服務器),
# 它將用ServerName和Port來構建一個規(guī)范的格式。
# 當此設置為off時,Apache將使用客戶端提供的"主機名:端口"
# 這將同時影響CGI腳本中的SERVER_NAME和SERVER_PORT
#
UseCanonicalName On
#
# TypesConfig 記錄媒體類型(mime.types)文件或類似的東東放置的位置
#
<IfModule mod_mime.c>
TypesConfig conf/mime.types
</IfModule>
#
# DefaultType 是服務器處理未確認類型的文件,如為止的擴展名,的默認類型。
# 如果你的服務器上主要包含的是文本或HTML文檔,"text/plain"是較好的設置
# 如果服務器上主要包含二進制文件,如應用程序或圖片,
# 最好設置成"application/octet-stream"防止瀏覽器將二進制文件以文本的方式顯示。
#
DefaultType text/plain
#
# mod_mime_magic模塊允許服務器使用文件自身的不同標識來確定文件類型。
# MIMEMagicFile指示模塊文件標識的定義所在的位置。
# mod_mime_magic不是默認服務器的一部分。
# (必須自行用LoadModule來追加 [見'全局環(huán)境'部分的 DSO 章節(jié)],
# 或者在編譯服務器時包含mod_mime_magic部分)
# 包含在 <IfModule> 中.
# 就是說,如果該模塊是服務器的一部分,MIMEMagicFile標識將執(zhí)行。
#
<IfModule mod_mime_magic.c>
MIMEMagicFile conf/magic
</IfModule>
#
# HostnameLookups: 注冊客戶端的機器名或IP地址。
# 例如: www.apache.org (on) 或 204.62.129.132 (off).
# 默認為off,因為對于網(wǎng)絡來說,最好讓人們有意識的設置為on,
# 因為開啟此功能意味著每個客戶請求將導致至少向name服務器發(fā)送一個lookup請求
#
HostnameLookups Off
#
# ErrorLog: 錯誤記錄文件的地址
# 如果不在<VirtualHost>內指定ErrorLog
# 改虛擬主機的錯誤心細將記錄到此處。
# 如果在<VirtualHost>中明確指定了錯誤記錄文件,
# 則錯誤將記錄在那兒而不是這兒。
#
ErrorLog logs/error.log
#
# LogLevel: 控制記錄在error.log中信息的個數(shù).
# 可能的值:debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn
#
# 以下標識定義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
#
# 訪問記錄的位置和格式 (功用的記錄文件格式).
# 如果不在<VirtualHost>中定義記錄文件,
# 那些訪問記錄就將保存在這兒。 Contrariwise, if you *do*
# 反之,如果指定了記錄文件,那么訪問記錄將記錄在那兒而不是這個文件中。
#
CustomLog logs/access.log common
#
# 如果希望使用代理和參考的記錄文件, 取消以下標識的注釋符
#
#CustomLog logs/referer.log referer
#CustomLog logs/agent.log agent
#
# 如果想在一個文件中記錄訪問、代理、參考信息(復合的記錄格式)
# 可使用以下標識
#
#CustomLog logs/access.log combined
#
# 在服務器產(chǎn)生的頁面(如錯誤文檔信息,F(xiàn)TP目錄列表等等,不包括CGI產(chǎn)生的文檔)中
# 增加一條服務器版本和虛擬主機名的信息。
# 設置為"EMail"將包含mailto: ServerAdmin的連接.
# 可選值: On | Off | EMail
#
ServerSignature On
#
# 默認下,Apache用工作行解析所有CGI腳本
# 此注釋行(腳本的第一行)包括'#'和'!'后面跟著執(zhí)行特殊腳本的程序路徑,
# 對perl腳本來說是C:\Program Files\Perl目錄中的perl.exe。
# 工作行如下:
#!c:/program files/perl/perl
# 注意真實的工作行不能有縮進,必須是文件的第一行。
# 當然,CGI進程必須通過適當?shù)膕criptAlias或ExecCGI選項標識來啟動。
#
# 然而,Windows下的Apache即允許以上的Unix方式,也可以通過注冊表的形式。
# 用注冊表執(zhí)行文件的方法同在Windows資源管理器中雙擊運行的注冊方法相同。
# 此腳本操作可在Windows資源管理器的“查看”菜單中設置。
# “文件夾選項”,然后查看“文件類型”。點擊編輯按鈕。
# 修改操作屬性。Apache 1.3會嘗試執(zhí)行‘Open'操作,
# 如果失敗則會嘗試工作行
# 這個屬性在Apache release 2.0中會有改變.
#
# 每個機制都有自身特定的安全弱點,這樣可能導致別人運行你不希望調用的程序。
# 最佳的解決方案還在討論中。
#
# 要是這個Windows的特殊屬性生效 (同時會是Unix屬性無效)
# 取消下列標識的注釋符。
#
#scriptInterpreterSource registry
#
# 上面的標識可在<Directory>塊或.htaccess文件中單獨替換。
# 可選擇'registry' (Windows behavior)或 'script'
# (Unix behavior) option, 將覆蓋服務器的默認值。
#
#
# Aliases: 可無限制的追加別名。格式如下:
# Alias 假名 真名
#
<IfModule mod_alias.c>
#
# 注意如果假名中包含'/',服務器會在當前URL中發(fā)出請求。
# 因此"/icons"不能用于別名
# 必須用 "/icons/"..
#
Alias /icons/ "C:/Program Files/Apache Group/Apache/icons/"
<Directory "C:/Program Files/Apache Group/Apache/icons">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
#
# scriptAlias: 控制哪個目錄包含服務器腳本。
# scriptAlias本質行和Aliases一樣。, except that
# 區(qū)別在于真名目錄中的文檔被看作是一個應用程序。
# 請求時由服務器運行而不是發(fā)往客戶端。
# "/"符號的規(guī)則同
# Alias相同.
#
scriptAlias /cgi-bin/ "C:/Program Files/Apache Group/Apache/cgi-bin/"
#
# "C:/Program Files/Apache Group/Apache/cgi-bin" 可修改為任何放置CGI腳本的目錄
#
<Directory "C:/Program Files/Apache Group/Apache/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
</IfModule>
# 別名結束
#php腳本說明
scriptAlias /php/ "d:/php/"
AddType application/x-httpd-php .php
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .phtml
Action application/x-httpd-php "/php/php.exe"
#php腳本說明結束
#
# Redirect 允許告訴客戶端服務器上曾經(jīng)有的文檔,但是現(xiàn)在不存在了。
# 并且可以告訴客戶端到哪兒去尋找。
# 格式: Redirect old-URL new-URL
#
#
# 控制服務器目錄列表顯示的標識
#
<IfModule mod_autoindex.c>
#
# FancyIndexing標識是使用特定的目錄檢索還是標準的(standard)
#
IndexOptions FancyIndexing
#
# AddIcon*表明不同文件或擴展名顯示的圖標。
# 這些圖標只在特定檢索狀態(tài)下顯示。
#
AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip
AddIconByType (TXT,/icons/text.gif) text/*
AddIconByType (IMG,/icons/image2.gif) image/*
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 用于為制定圖標的文件所顯示的圖標。
#
DefaultIcon /icons/unknown.gif
#
# AddDescription在服務器生成的檢索的某個文件后追加小段說明。
# 此項只在設置為FancyIndexed時有效
# 格式:AddDescription "描述" 文件名
#
#AddDescription "GZIP compressed document" .gz
#AddDescription "tar archive" .tar
#AddDescription "GZIP compressed tar archive" .tgz
#
# ReadmeName是服務器默認的README文件。
# 并且會追加到目錄列表的最后。
#
# HeaderName 是目錄中需要預先顯示內容的文件名。
#
# 如果MultiViews在選項中,作為結果,服務器將先找name.html,
# 如果存在就包含它。如果name.html不存在,
# 服務器會繼續(xù)尋找name.txt。如果存在就作為純文本包含進來。
#
ReadmeName README
HeaderName HEADER
#
# IndexIgnore是一系列的文件名。目錄索引將忽略這些文件并且不包含在列表中。
# 允許使用通配符。
#
IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t
</IfModule>
# indexing標識結束
#
# 文件類型
#
<IfModule mod_mime.c>
#
# AddEncoding 可用于特殊瀏覽器(Mosaic/X 2.1+)快速傳輸壓縮信息。
# 注:并不是所有的服務器都支持。
# 除了名字相似,以下Add*標識對上面的FancyIndexing定制標識無影響。
#
AddEncoding x-compress Z
AddEncoding x-gzip gz tgz
#
# AddLanguage用于指定文檔的語言。
# 可以使用content標簽指定每個文件的語言。
#
# 注 1: 后綴不必與所用語言的關鍵字相同。
# --- 波蘭語(Polish,標準代碼為pl)的文檔可以用
# "AddLanguage pl .po" 來避免與perl腳本文件混淆。
#
# 注 2: 以下例子表明兩個字母的語言縮寫和兩個字母的國家縮寫并不一定相同。
# E.g. 'Danmark/dk' 對比 'Danish/da'.
#
# 注 3: 其中'ltz'使用了三個字符,與RFC的規(guī)定不同。
# 但是這個問題正在修訂中,并且重新清理RFC1766
#
# 丹麥Danish (da) - 荷蘭Dutch (nl) - 英國English (en) - 愛薩尼亞Estonian (ee)
# 法國French (fr) - 德國German (de) - 現(xiàn)代希臘文Greek-Modern (el)
# 意大利Italian (it) - 朝鮮Korean (kr) - 挪威Norwegian (no)
# 葡萄牙Portuguese (pt) - 盧森堡Luxembourgeois* (ltz)
# 西班牙Spanish (es) - 瑞典Swedish (sv) - 加泰羅尼亞Catalan (ca) - 捷克Czech(cz)
# 波蘭Polish (pl) - 巴西Brazilian Portuguese (pt-br) - 日本Japanese (ja)
# 俄國Russian (ru)
#
AddLanguage da .dk
AddLanguage nl .nl
AddLanguage en .en
AddLanguage et .ee
AddLanguage fr .fr
AddLanguage de .de
AddLanguage el .el
AddLanguage he .he
AddCharset ISO-8859-8 .iso8859-8
AddLanguage it .it
AddLanguage ja .ja
AddCharset ISO-2022-JP .jis
AddLanguage kr .kr
AddCharset ISO-2022-KR .iso-kr
AddLanguage no .no
AddLanguage pl .po
AddCharset ISO-8859-2 .iso-pl
AddLanguage pt .pt
AddLanguage pt-br .pt-br
AddLanguage ltz .lu
AddLanguage ca .ca
AddLanguage es .es
AddLanguage sv .se
AddLanguage cz .cz
AddLanguage ru .ru
AddLanguage tw .tw
AddCharset Big5 .Big5 .big5
AddCharset WINDOWS-1251 .cp-1251
AddCharset CP866 .cp866
AddCharset ISO-8859-5 .iso-ru
AddCharset KOI8-R .koi8-r
AddCharset UCS-2 .ucs2
AddCharset UCS-4 .ucs4
AddCharset UTF-8 .utf8
# LanguagePriority 可設置語言的優(yōu)先級。
#
# 優(yōu)先級降序排列
# 在此處按照字母順序,可自行修改
#
<IfModule mod_negotiation.c>
LanguagePriority en da nl et fr de el it ja kr no pl pt pt-br ru ltz ca es sv tw
</IfModule>
#
# AddType 可臨時改變mime.types或者指定特殊文件的格式。
#
# 例如:PHP 3.x 模塊 (非Apache標準配件,參見http://www.php.net)可用下面格式定義:
#
#AddType application/x-httpd-php3 .php3
#AddType application/x-httpd-php3-source .phps
#
# PHP 4.x, 使用:
#
#AddType application/x-httpd-php .php
#AddType application/x-httpd-php-source .phps
AddType application/x-tar .tgz
#
# AddHandler 可將特定文件擴展名映射到處理方法上。
# 與文件類型無關。此特性可內建到服務器中或者追加在操作指令中(見下)
#
# 如果希望用服務器端應用或scriptAliased外的CGI,取消以下行的注釋符
#
# 用CGI腳本:
#
#AddHandler cgi-script .cgi
#
# 用服務器解析的HTML文檔
#
#AddType text/html .shtml
#AddHandler server-parsed .shtml
#
# 取消以下注釋符可激活Apache的send-asis HTTP file特性
#
#AddHandler send-as-is asis
#
# 如果使用服務器端解析的圖像定位文件,使用以下標識:
#
#AddHandler imap-file map
#
# 要激活type maps使用:
#
#AddHandler type-map var
</IfModule>
# 文檔類型說明結束
#
# Action 定義在文件匹配時執(zhí)行相應的腳本。
# 可簡化常用CGI文件的調用。
# 格式: Action media/type /cgi-script/location
# 格式: Action handler-name /cgi-script/location
#
#
# MetaDir: 指定保存meta信息文件的目錄。
# 這些文件包含附加的HTTP頭,在發(fā)送文檔是一并發(fā)送。
#
#MetaDir .web
#
# MetaSuffix: 指定包含meta信息的文件的后綴。
#
#MetaSuffix .meta
#
# 可定制的錯誤響應(Apache類型)
# 共三種風格:
#
# 1) 純文本
#ErrorDocument 500 "The server made a boo boo.
# 注: 第一個"號用于表示是文本,實際不輸出
#
# 2) 本地重定向
#ErrorDocument 404 /missing.html
# to redirect to local URL /missing.html
#ErrorDocument 404 /cgi-bin/missing_handler.pl
# 注:可重定向到任何一個服務器端的腳本或文檔
#
# 3) 外部重定向
#ErrorDocument 402 http://some.other_server.com/subscription_info.html
# 注: 大部分與初始請求關聯(lián)的環(huán)境變量對這樣的腳本無效。
#
#
# 基于瀏覽器的定制操作
#
<IfModule mod_setenvif.c>
#
# 以下標識修改普通的HTTP響應操作。
# 第一個標識針對Netscape2.x和其他無此功能的瀏覽器取消保持激活狀態(tài)的功能
# 這些瀏覽器在執(zhí)行這些功能時會出錯。
# 第二個標識針對IE4.0b2設置。其中有一條不完整的HTTP/1.1指令
# 在301或302(重定向)響應時不能正確的保持激活狀態(tài)
#
BrowserMatch "Mozilla/2" nokeepalive
BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
#
# 下面的標識通過不產(chǎn)生基本的1.1響應取消對違反HTTP/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
</IfModule>
# 瀏覽器定制標識結束
#
# 允許使用URL"http://servername/server-status"的形式查看服務器狀態(tài)報告
# 修改 ".your_domain.com"來匹配相應的域名以激活此功能
#
#<Location /server-status>
# SetHandler server-status
# Order deny,allow
# Deny from all
# Allow from .your_domain.com
#</Location>
#
# 允許使用URL"://servername/server-info"(要求加載mod_info.c),
# 來遠程察看服務器配置報告。
# 修改 ".your_domain.com"來匹配相應的域名以激活此功能
#
#<Location /server-info>
# SetHandler server-info
# Order deny,allow
# Deny from all
# Allow from .your_domain.com
#</Location>
#
# 據(jù)報有人試圖利用一個老的1.1漏洞。
# 這個漏洞與CGI腳本在Apache服務器上分布有關。
# 通過取消下面幾行的注釋符,可以將此類攻擊記錄轉移到phf.apache.org上的記錄腳本上。
# 或者也可以利用腳本scriptsupport/phf_abuse_log.cgi記錄在本地服務器上。
#
#<Location /cgi-bin/phf*>
# Deny from all
# ErrorDocument 403 http://phf.apache.org/phf_abuse_log.cgi
#</Location>
#
# 代理服務器標識。取消下列行的注釋符可激活代理服務器。
#
#<IfModule mod_proxy.c>
# ProxyRequests On
# <Directory proxy:*>
# Order deny,allow
# Deny from all
# Allow from .your_domain.com
# </Directory>
#
# 激活/取消處理HTTP/1.1 "Via:" 報頭
# ("Full":加入服務器版本; "Block":取消所有外發(fā)的Via: 報頭)
# 可設置值: Off | On | Full | Block
#
# ProxyVia On
#
# 可修改下列各行并取消注釋符來激活緩存。
# (沒有CacheRoot標識就不使用緩存)
#
# CacheRoot "E:/Program Files/Apache Group/Apache/proxy"
# CacheSize 5
# CacheGcInterval 4
# CacheMaxExpire 24
# CacheLastModifiedFactor 0.1
# CacheDefaultExpire 1
# NoCache a_domain.com another_domain.edu joes.garage_sale.com
#</IfModule>
# 代理標識結束
### 部分 3: 虛擬主機
#
# 虛擬主機: 如果希望在一臺服務器上實現(xiàn)多個域名和主機名的服務,
# 可設置VirtualHost來實現(xiàn)。Most configurations
# 大部分的設置使用基于名稱的虛擬主機,這樣服務器就不必為IP地址操心。
# 這些用星號在下面的標識中標出。
#
# 在試圖設置虛擬主機前
# 請閱讀<URL:http://www.apache.org/docs/vhosts/>中的文檔。
# 以了解細節(jié)問題。
#
# 可用命令行參數(shù) '-S'來確認虛擬主機的設置。
#
#
# 使用基于名稱的虛擬主機
#
#NameVirtualHost *
#
# 虛擬主機實例:
# 幾乎所有的Apache標識都可用于虛擬主機內。
# 第一個VirtualHost部分用于申請一個無重復的服務器名。
#
#<VirtualHost *>
# ServerAdmin webmaster@dummy-host.example.com
# 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>
相關文章
Linux下nginx生成日志自動切割的實現(xiàn)方法
這篇文章主要介紹了 Linux下nginx生成日志自動切割的實現(xiàn)方法的相關資料,希望通過本文能幫助到大家,讓大家實現(xiàn)這樣的功能看,需要的朋友可以參考下2017-10-10CentOS 5.5使用yum來安裝LAMP(php運行環(huán)境)
今天用yum方法搭建起了個LAMP環(huán)境,中間遇到了很多問題,經(jīng)過google和各位前輩的幫助,終于將環(huán)境搭建起來,現(xiàn)在把完整的步驟記錄下來,2010-09-09Linux /etc/network/interfaces配置接口方法
在本篇文章里小編給各位分享的是一篇關于Linux /etc/network/interfaces配置接口方法知識點,需要的朋友們可以學習下。2020-02-02詳解Linux中PostgreSQL和PostGIS的安裝和使用
這篇文章主要介紹了詳解Linux中PostgreSQL和PostGIS的安裝和使用,并把需要注意點做了分析和解釋,需要的朋友學習下。2018-02-02Linux系統(tǒng)實現(xiàn)ansible自動化安裝配置httpd的方法
這篇文章主要介紹了Linux系統(tǒng)實現(xiàn)ansible自動化安裝配置httpd的方法,本文圖文并茂給大家介紹的非常詳細,具有一定的參考借鑒價值,需要的朋友可以參考下2020-02-02