Apache服务器主配置文件httpd.conf详解

2019-01-17 03:47:01王旭

#
# 每个机制都有自身特定的安全弱点,这样可能导致别人运行你不希望调用的程序。
# 最佳的解决方案还在讨论中。
#
# 要是这个Windows的特殊属性生效 (同时会是Unix属性无效)
# 取消下列标识的注释符。
#
#scriptInterpreterSource registry
#
# 上面的标识可在<Directory>块或.htaccess文件中单独替换。
# 可选择'registry' (Windows behavior)或 'script'
# (Unix behavior) option, 将覆盖服务器的默认值。
#

#
# Aliases: 可无限制的追加别名。格式如下:
# Alias 假名 真名
#
<IfModule mod_alias.c>

#
# 注意如果假名中包含'/',服务器会在当前URL中发出请求。
# 因此"/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
# 区别在于真名目录中的文档被看作是一个应用程序。
# 请求时由服务器运行而不是发往客户端。
# "/"符号的规则同
# 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 允许告诉客户端服务器上曾经有的文档,但是现在不存在了。
# 并且可以告诉客户端到哪儿去寻找。
# 格式: Redirect old-URL new-URL
#

#
# 控制服务器目录列表显示的标识
#
<IfModule mod_autoindex.c>

#
# FancyIndexing标识是使用特定的目录检索还是标准的(standard)
#
IndexOptions FancyIndexing

#
# AddIcon*表明不同文件或扩展名显示的图标。
# 这些图标只在特定检索状态下显示。
#
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/*