站点图标 IDC铺

Apache主配置文件httpd.Conf详解

# This is the main Apache server configuration file. It contains the # configuration directives that give the server its instructions. # See for detailed information. # In particular, see # # 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. Theyre 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 arent 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服务器参数定义,# 这些参数响应非虚拟主机的操作请求同时也为所以虚拟主机提供了默认设定值。

# 3. 设置虚拟主机,可以通过一个Apache服务器来实现处理不同IP或者主机名的Web请求 # Configuration and logfile names: If the filenames you specify for many # of the servers 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:/”开头,来指定服务器的控制文件名,服务器将使用显式路径。

# 如果未用“/”开头,比如文件名“logs/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. ### 章节1:全局环境# 这节的指令影响Apache的整体操作,比如它能操作的当前连接请求数目或者去哪里# 查找其配置文件等。

# Dont give away too much information about all the subcomponents # we are running. Comment out this line if you dont mind remote sites # finding out what major optional modules you are running ServerTokens OS # 不要泄漏太多的服务器信息。

# 如果不想让远程站点了解到你的主要选型模块信息,可以注释掉该行 # ServerRoot: The top of the directory tree under which the servers # 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 ); # you will save yourself a lot of trouble. # # Do NOT add a slash at the end of the directory path. # ServerRoot “/etc/httpd” # 服务器的根:目录树的顶部,其下存放着配置、错误,以及日志文件等。

## 注意!如果你打算将它放到挂载文件系统的NFS(或者其他网络),建议参阅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:确定发送超时和接收超时的秒数。

Timeout 120 # # KeepAlive: Whether or not to allow persistent connections (more than # one request per connection). Set to “Off” to deactivate. # KeepAlive Off # KeepAlive:是否允许保持连接状态(每次连接可以执行多个请求)。

一般设置为“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:持续连接最大数。

0表示无限数量# 为了最大性能,推荐将其设置高一点MaxKeepAliveRequests 100 # # KeepAliveTimeout: Number of seconds to wait for the next request from the # same client on the same connection. # KeepAliveTimeout 15 # KeepAliveTimeout:同一客户端同一连接请求的间隔秒数。

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 StartServers 8 MinSpareServers 5 MaxSpareServers 20 ServerLimit 256 MaxClients 256 MaxRequestsPerChild 4000 # prefork MPM(预分离多进程模块)# StartServices:服务器启动进程数# MinSpareServers:最小空闲进程数# MaxSpareServers:最大空闲进程数# ServerLimit:最大进程数MaxClients时,服务器的最大生存时间值# MaxClients:服务器运行启动的最大进程数量# MaxRequestPerChild:每个服务子进程的最大请求数量StartServers 8MinSpareServers 5MaxSpareServers 20ServerLimit 256MaxClients 256MaxRequestsPerChild 4000 # 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 StartServers 2 MaxClients 150 MinSpareThreads 25 MaxSpareThreads 75 ThreadsPerChild 25 MaxRequestsPerChild 0 # worker 多进程模块# StartServers:服务器启动进程的初始化数目# MaxClients:同时客户端连接的最大数目# MinSpareThreads:最小空闲worker线程数# MaxSpareThreads:最大空闲worker线程数# ThreadsPerChild:每个服务器子进程的worker线程数# MaxRequestsPerChild:每个子进程的最大请求数StartServers 2MaxClients 150MinSpareThreads 25MaxSpareThreads 75ThreadsPerChild 25MaxRequestsPerChild 0 # # Listen: Allows you to bind Apache to specific IP addresses and/or # ports, in addition to the default. See also the # 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地址和/或端口。

也可# 查看指令# # 如下设置特定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 # # # 动态共享对象(DSO)支持# # 为了能使用编译为DSO的模块函数,我们必须将相应的‘LoadModule’行放在此处,这样模块中的指令将有效。

# 静态编译模块(用‘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是否产生“full”状态信息(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; # dont use Group #-1 on these systems! # User apache Group apache # 如果想要httpd作为一个不同用户或组来运行,最初就必须以root来运行httpd,它会切换到其他用户或组去。

# # 用户/组:作为运行httpd的用户/组的名称# – 在SCO(ODT 3)上,使用“User nouser”和“Group nogroup”# – 在HPUX上,将无法使用共享存储作为nobody,建议的解决办法是创建一个用户www并使用这个用户。

# 注意,有的内核不支持60000以上的组ID值,在这些系统中不要使用“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 arent handled by a # definition. These values also provide defaults for # any containers you may define later in the file. # # All of these directives may appear inside containers, # in which case these default settings will be overridden for the # virtual host being defined. # ### 章节2:‘Main’服务器配置# # 该章节设置‘Main’服务器使用的指令,响应所有非定义的请求。

# 这些指令值也为部分提供默认值# # 所有这些指令都可以在段中出现,此时,这些默认值将被虚拟主机的相关设置值所覆盖 # # 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:服务器管理员的邮箱地址,该地址一般出现在服务器生成页中,比如错误文档等。

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 doesnt 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. # Options FollowSymLinks AllowOverride None # 每个apache存取的目录(包括子目录)都可配置为允许和禁止。

# # 首先,我们配置严格特征集合的默认值# Options FollowSymLinks AllowOverride None # # Note that from this point forward you must specifically allow # particular features to be enabled – so if somethings 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值进行修改。

# # 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” # doesnt 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 允许优先,用来控制哪些指令可以放到.htaccess文件中。

# 可以是“All”、“None”,或者下面关键字的任何组合:#   Options FileInfo AuthConfig Limit#   AllowOverride None # # Controls who can get stuff from this server. # Order allow,deny Allow from all # 控制谁可能获得服务器阻塞  Order allow,deny  Allow from all # # UserDir: The name of the directory that is appended onto a users 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 # # # 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 users public_html # directory, remove the “UserDir disable” line above, and uncomment # the following line instead: # #UserDir public_html # UserDir:当接收到~user请求时,附加到用户home目录上的目录名称。

# # 端用户账户路径‘public_html’路径对web服务器用户id必须是可存取的# 这通常意味着~userid必须拥有711权限值,~userid/public_html必须有755权限值,# 并且其中包含的文件都是公开的。

否则,客户端只能收到“403 Forbidden”消息# # 可查阅:http://httpd.apache.org/docs/misc/FAQ.html#forbidden#   # UserDir默认被禁止掉,这样可以确定一个系统用户名的存在(依赖home路径许可)。

UserDir disable    # 要使能/~user/请求以提供用户的public_html目录的话,删除上面的“UserDir disable”行,  # 并且取消下面的注释:  #UserDir public_html # # Control access to UserDir directories. The following is an example # for a site where these directories are restricted to read-only. # # # AllowOverride FileInfo AuthConfig Limit # Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec # # Order allow,deny # Allow from all # # # Order deny,allow # Deny from all # # # UserDir目录的存取控制。

以下是一个这些目录被限制到只读的站点示例# ## AllowOverride FileInfo AuthConfig Limit# Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec# # Order allow,deny# Allow from all# # # Order deny,allow# Deny from all# # # # 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文件用来传递内容协商了的文档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. # Order allow,deny Deny from all # 下面的行防止.htaccess和.htpasswd文件被Web客户端查看。

Order allow,deny Deny from all # # 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. # # MIMEMagicFile /usr/share/magic.mime MIMEMagicFile conf/magic # mod_mime_magic模块允许服务器从文件内容来确定文件类型。

# MIMEMagicFile指令告诉该模块隐含文件类型信息的位置# MIMEMagicFile /usr/share/magic.mime MIMEMagicFile conf/magic # # 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 itd 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对整个网络比较好,如果有人明知却非要打开这个特性,那么使能它意味着每个客户端请求都将# 导致至少一个域名服务器查询请求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:存储器镜像文件传输控制(需要操作系统的支持)。

# 默认为on;如果从NFS-mounted文件系统提供文件则设为off# 有些系统,设为off(不考虑文件系统)能提高性能;详情请# 查阅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:文件传输内核使能控制(需要系统支持)。

# 默认为on;如果从NFS-mounted文件系统提供文件则设为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 # container, error messages relating to that virtual host will be # logged here. If you *do* define an error logfile for a # container, that hosts errors will be logged there and not here. # ErrorLog logs/error_log # 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 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”包含实际接收和发送字节的实际计数;这需要加载mod_logio模块 # # The location and format of the access logfile (Common Logfile Format). # If you do not define any access logfiles within a # container, they will be logged here. Contrariwise, if you *do* # define per- access logfiles, transactions will be # logged therein and *not* in this file. # #CustomLog logs/access_log common # 普通日志文件的位置和格式。

# 若在段中定义该指令,则其普通日志文件不会存在该文件中# #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” isnt 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/” Options Indexes MultiViews AllowOverride None Order allow,deny Allow from all # Aliases:在此添加无限个你需要的别名。

# 格式为 Alias 别名 真名# 注意,如果别名中以“/”结尾,则服务器将要求“/”出现在URL中# 别名中有“/”,则真名中必须有“/”反之亦然# # # WebDAV module configuration section. # # Location of the WebDAV lock database. DAVLockDB /var/lib/dav/lockdb # WebDAV模块配置部分。

# WebDAV锁定数据库的位置设置 # # 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:服务器脚本目录别名。

# 脚本目录存放服务器响应请求时执行的应用程序,而非发送给客户端的文件# “/”的处理跟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. # AllowOverride None Options None Order allow,deny Allow from all # “/var/www/cgi-bin”应当对应到你自己的CGI路径,如果你需要该配置。

# # Redirect allows you to tell clients about documents which used to exist in # your servers 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 # 重定向允许你告诉客户端曾经在你空间中使用的文档已经不存在了。

通知客户端去什么位置查找文档 # # 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

退出移动版