`

Apache配置文件(httpd.conf)中文说明(二)

阅读更多

#

# EnableSendfile:控制是否使用sendfile kernel支持发送文件

# (如果操作系统支持的话)。默认为on,如果你的服务器安装在网络文件系统

# NFS)上,请你关闭它。

# 参见<a href="http://httpd.apache.org/docs-2.0/mod/core.html#enablesendfile" target="_blank">http://httpd.apache.org/docs-2.0/mo...#enablesendfile</a>

#

 EnableSendfile off

 

#

# ErrorLog:错误日志文件定位。

# 如果你没有在<VirtualHost>内定义ErrorLog指令,这个虚拟主机的错误信息

# 将记录在这里。如果你在那儿定义了ErrorLog,这些错误信息将记录在你所

# 定义的文件里,而不是这儿定义的文件。

#

 

ErrorLog logs/error_log

 

#

# LogLevel:控制记录在错误日志文件中的日志信息数量。

# 可能的值包括:debuginfonoticewarnerrorcritalertemerg

#

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

 

# 你需要安装了mod_logio.c模块才能使用%I%O

# LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio

 

#

# 指定接入日志文件的定位和格式(一般日志格式)。

# 如果你没有在<VirtualHost>内定义这个指令,传输信息将记录在这里,

# 如果你定义了这个指令,则记录在你指定的位置,而不是这儿定义的位置。

#

 

CustomLog logs/access_log common

 

#

# 如果你想要记录agentreferer信息,可以使用下面的指令

#

# CustomLog logs/referer_log referer

# CustomLog logs/agent_log agent

 

#

# 如果你想要使用一个文件记录accessagentreferer信息,

# 你可以如下定义这个指令:

#

# CustomLog logs/access_log combined

 

#

# ServerTokens

# 这个指令定义包含在HTTP回应头中的信息类型。默认为“Full”,

# 这表示在回应头中将包含模块中的操作系统类型和编译信息。

# 可以设为列各值中的一个:

# Full | OS | Minor | Minimal | Major | Prod

# Full传达的信息最多,而Prod最少。

#

 

ServerTokens Full

 

#

# 随意的添加包含服务器版本和虚拟主机名字一行信息到server-generated输出页中

# (内部错误文档,FTP目录列表,mod_statusmod_info输出等等,除了CGI错误

# 或自定义的错误文档以外)。

# 设为“EMail”将包含一个指向ServerAdminmailto:连接。

# 可以为如下值:On | Off | EMail

#

 

ServerSignature On

 

#

# Aliases:在这时添加你需要的别名,格式如下:

# Alias 别名 真实名

#

# 注意,如果你在别名的未尾包含了“/”,那么在URL中也需要包含“/”。

# 因此,“/icons”不是这个示例中的别名。

# 如果别名中以“/”结尾,那么真实名也必须以“/”结尾,

# 如果别名中省略了结尾的“/”,那么真实名也必须省略。

#

# 我们使用别名“/icons/”来表示FancyIndexed目录列表,如果你不使用、

# FancyIndexing,你可以注释掉它。

#

# Alias /icons/ "/usr/local/apache2/icons/"

 

# <Directory "/usr/local/apache2/icons">

# Options Indexes MultiViews

# AllowOverride None

# Order allow,deny

## Allow from all

# </Directory>

 

#

# 这将改变ServerRoot/manual。这个别名提供了手册页所在的位置,

# 即使你改变了你的DocumentRoot。如果你对有无手册页并不在意的话,

# 你可以注释掉它。

#

Alias /manual "/usr/loacl/apache2/manual"

<Directory "/usr/local/apache2/manual">

Options Indexes FollowSymLinks MultiViews IncludesNoExec

AddOutputFilter Includes html

Order allow,deny

Allow from all

</Directory>

 

#

# ScriptAlias:指定包含服务脚本的目录。

# ScriptAliases 本质上与Aliases一样,除了这里的文档在请求时做为程序处理处理以外。

# 尾部的“/”规则与Alias一样

#

ScriptAlias /cgi-bin/ "/usr/loacl/apache2/cgi-bin/"

 

# 这里是添加php 4支持的指令

AddType application/x-httpd-php .php

LoadModule php4_module modules/libphp4.so

 

<IfModule mod_cgid.c>

#

# 添加mod_cgid.c设置,mod_cgid提供使用cgid进行通讯的UNIX套接字的

# 脚本接口路径。

#

# Scriptsock logs/cgisock

</IfModule>

 

#

# "/usr/local/apache2/cgi-bin"改为你的ScriptAliased指定的CGI目录,

# 如果你配置了的话。

#

<Directory "/usr/local/apache2/cgi-bin">

AllowOverride None

Options None

Order allow,deny

Allow from all

</Directory>

 

#

# Redirect允许你告诉客户端使用存在于服务器名字空间中的文档,

# 而不是现在的,这帮助客户定位那些改变了位置的文档。

# 例如:

# Redirect permanent /foo  http://www.example.com/bar

# 控制server-generated目录列表显示的指令

#

#

# IndexOptions:控制server-generated目录列表显示特征。

#

IndexOptions FancyIndexing VersionSort

 

#

# AddIcon* 指令告诉服务器不同扩展名的图象文件如何显示,

# 只适用于FancyIndexed指令

#

AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip

AddIconByType (TXT,/icons/text.gif) text

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics