默認情況下,Apache服務器會列出網站目錄中的文件及子目錄,這對於用於發佈站點的服務器來說是很不安全的,所以需要禁用,修改httpd.conf配置文件中的對應設置即可。
問題的現象:
如果你的網站目錄下有一個xxx的文件夾,如果xxx文件夾下沒有默認頁面(index.*等),當用戶使用URL:http://你的網址/a/ 訪問你的網站的話,Apache會把xxx文件夾裏的內容全列出來。
解決方法:
要禁止此功能,修改httpd.conf
找到下面這一句刪除掉Indexes即可。
Options Indexes FollowSymLinks
配置示例:
<Directory "E:/Program Files/Apache Software Foundation/Apache2.2/htdocs">
#
# 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.
# 就是這一行,只去掉indexes也可
#Options Indexes FollowSymLinks
Options 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
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>
建議默認情況下,設置APACHE禁止用戶瀏覽目錄內容。