Apache 禁止目录索引显示 禁止蜘蛛抓起目录列表

问题 没有index.html文件 apache会显示目录结构 如下图

修改文件目录参考 D:\PC_webserver\apache\conf\extra\httpd-vhosts.conf

加粗部分为修改部分。

修改地方:Options Indexes FollowSymLinks # 修改为: Options  FollowSymLinks

只需要将上面代码中的 Indexes 去掉,就可以禁止 Apache 显示该目录结构。用户就不会看到该目录下的文件和子目录列表了。Indexes 的作用就是当该目录下没有 index.html 文件时,就显示目录结构,去掉 Indexes ,Apache 就不会显示该目录的列表了。

NameVirtualHost *:80
<VirtualHost *:80>
	ServerAdmin phpip.com@gmail.com
	DocumentRoot D:/PC_webserver/phproot
	ServerName localhost
	<Directory "D:/PC_webserver/phproot">

	Options FollowSymLinks
	AllowOverride Options FileInfo
	Order allow,deny
	Allow from all
	DirectoryIndex index.htm index.html index.php
	</Directory>
	Alias /phpmyadmin "D:/PC_webserver/phpMyAdmin/"
		<Directory "D:/PC_webserver/phpMyAdmin">
		AllowOverride AuthConfig
		Order allow,deny
		Allow from all
	</Directory>
</VirtualHost>

<VirtualHost *:80>
	
	DocumentRoot D:/PC_webserver/phproot/m
	ServerName m.netnic.com.cn
	<Directory "D:/PC_webserver/phproot/m">

	Options  FollowSymLinks
	AllowOverride Options FileInfo
	Order allow,deny
	Allow from all
	DirectoryIndex index.htm index.html index.php
	</Directory>
	
</VirtualHost>

  

posted @ 2016-05-30 14:43  星耀学园  阅读(349)  评论(0编辑  收藏  举报