禁止Apache显示目录索引
来源:互联网 发布:大数据算法 王宏志 编辑:程序博客网 时间:2024/06/05 08:51
禁止Apache显示目录索引,禁止Apache显示目录结构列表,禁止Apache浏览目录,这是网上提问比较多的,其实都是一个意思。
下面说下禁止禁止Apache显示目录索引的常见的3种方法。
要实现禁止Apache显示目录索引,只需将 Option 中的 Indexes 去掉即可。
1.修改目录配置
Options indexes
FollowSymLinks,indexes的作用是,如果这个目录下面没有index文件,那么有indexes属性,那么就会把当前的目录结构在浏览器中列出来;如果没有indexes,则不会列出目录
<Directory "/var/www/html"> Options indexes FollowSymLinks AllowOverride None Order allow,deny Allow from all</Directory>
网站目录”/var/www/html”配置如下
测试结果如下
2.修改apache的httpd.conf属性
搜索“Options Indexes FollowSymLinks”,修改为“Options FollowSymLinks”即可。 在Options Indexes FollowSymLinks在Indexes前面加上 – 符号。备注:在Indexes前,加 + 代表允许目录浏览;加 – 代表禁止目录浏览。这样的话就属于整个Apache禁止目录浏览了。
经过测试在apache2.2.15版本中,使用’+-‘并不适用,而是需要把indexes添加或者删除才可以
如果是配置虚拟机,则如下:
<VirtualHost *> <Directory "../vhosts/xx.xxx.com"> Options indexes FollowSymLinks # 修改为 -Indexes 即可 </Directory> ServerAdmin mail@jb51.com DocumentRoot "../vhosts/xx.xxx.com" ServerName xx.xxx.com:80 ServerAlias xx.xxx.com ErrorLog logs/xx.xxx.com-error_log</VirtualHost>
3.通过.htaccess文件来实现
可以在根目录新建或修改 .htaccess 文件中添加
<Files *> Options -Indexes</Files>
0 0
- 禁止Apache显示目录索引
- 禁止Apache显示目录索引
- 禁止Apache显示目录索引的常见方法
- 禁止apache显示目录索引的常见方法
- apache在目录没有index时禁止显示目录索引列表
- 禁止apache显示目录索引的常见方法(apache禁止列目录)
- 禁止apache显示目录索引的常见方法(apache禁止列目录)
- 禁止apache显示目录索引的常见方法(apache禁止列目录)
- 禁止apache显示目录索引的常见方法(apache禁止列目录)
- cent os 6.4禁止apache显示目录索引的常见方法(apache禁止列目录)
- Apache不显示目录索引
- 禁止 Apache 显示目录列表
- 禁止/显示Apapche目录索引 (取消/添加 Option 后的 Indexes)
- apache 设置 禁止显示 Apache 目录列表
- 禁止显示Apache目录列表-Indexes FollowSymLinks
- Apache显示和禁止目录列表
- 禁止Apache显示目录的方法
- 禁止显示Apache目录列表-Indexes FollowSymLinks
- Java基础部分个人学习记录
- Qt error:: write access violation at: 0x1, flags=0x0 (first chance)
- 随机数
- iOS 将xib 视图中的视图拖拽到响应的ViewController中
- wampserver的本地访问和局域网访问
- 禁止Apache显示目录索引
- Android笔记3
- 剑指offer-整数中1出现的次数
- Git merge 冲突解决简明教程
- MongoDB 数据存储引擎
- Linux下查看用户列表
- codevs 3955 最长严格上升子序列(加强版)
- 出生到现在多少天
- MySQL 备份还原