禁止显示Apache文件夹列表-Indexes FollowSymLinks

怎样改动文件夹的配置以禁止显示 Apache 文件夹列表。

缺省情况下假设你在浏览器输入地址:

http://localhost:8080/

假设你的文件根文件夹里有 index.html,浏览器就会显示 index.html的内容,假设没有 index.html,浏览器就会显示文件根文件夹的文件夹列表,文件夹列表包含文件根文件夹下的文件和子文件夹。

相同你输入一个虚拟文件夹的地址:

http://localhost:8080/b/

假设该虚拟文件夹下没有 index.html,浏览器也会显示该虚拟文件夹的文件夹结构,列出该虚拟文件夹下的文件和子文件夹。

怎样禁止 Apache 显示文件夹列表呢?

要禁止 Apache 显示文件夹结构列表,仅仅需将 Option 中的 Indexes 去掉就可以。

比方我们看看一个文件夹的文件夹配置:

<Directory "D:/Apa/blabla">

 Options Indexes FollowSymLinks #---------->Options FollowSymLinks

 AllowOverride None

 Order allow,deny

 Allow from all

</Directory>

你仅仅须要将上面代码中的 Indexes 去掉,就能够禁止 Apache 显示该文件夹结构。用户就不会看到该文件夹下的文件和子文件夹列表了。

Indexes 的作用就是当该文件夹下没有 index.html 文件时,就显示文件夹结构。去掉 Indexes,Apache 就不会显示该文件夹的列表了。

另外一种方法

解决的方法:

        1、编辑httpd.conf文件

            vi ./conf/httpd.conf

找到例如以下内容:

          ?BR>          <Directory “C:/Program Files/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.

              #

              Options Indexes 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>

          ……

在Options Indexes FollowSymLinks在Indexes前面加上 – 符号。

即: Options -Indexes FollowSymLinks

   【备注:在Indexes前,加 + 代表同意文件夹浏览;加 – 代表禁止文件夹浏览。】

这种话就属于整个Apache禁止文件夹浏览了。

假设是在虚拟主机中。仅仅要添加例如以下信息即可:

           <Directory “D:test”>

             Options -Indexes FollowSymLinks

             AllowOverride None

             Order deny,allow

             Allow from all

         </Directory>

     这种话就禁止在testproject下进行文件夹浏览。

备注: 切记莫把“Allow from all”改成 “Deny from all”。否则,整个站点都不能被打开。

   <Finished>

另一种方法:

能够在根文件夹的 .htaccess 文件里输入

<Files *>

Options -Indexes

</Files>

就能够阻止Apache 将文件夹结构列表出来。

Apache Options Indexes FollowSymLinks具体解释的更多相关文章

  1. Apache Options Indexes FollowSymLinks详解

    禁止显示Apache目录列表-Indexes FollowSymLinks如何修改目录的配置以禁止显示 Apache 目录列表.缺省情况下如果你在浏览器输入地址: http://localhost:8 ...

  2. 【转】Apache Options Indexes FollowSymLinks详解

    禁止显示Apache目录列表-Indexes FollowSymLinks如何修改目录的配置以禁止显示 Apache 目录列表.缺省情况下如果你在浏览器输入地址: http://localhost:8 ...

  3. Apache Options Indexes FollowSymLinks之讲解

    禁止显示Apache目录列表-Indexes FollowSymLinks 如何修改目录的配置以禁止显示 Apache 目录列表. 缺省情况下如果你在浏览器输入地址: http://localhost ...

  4. Apache服务器的Options 的 Indexes FollowSymLinks详解

    禁止显示Apache目录列表 - Indexes FollowSymLinks 如何修改目录的配置以禁止显示 Apache 目录列表. 缺省情况下如果你在浏览器输入地址: http://localho ...

  5. **Apache Options指令详解

    http://www.365mini.com/page/apache-options-directive.htm Options指令是Apache配置文件中一个比较常见也比较重要的指令,Options ...

  6. 【Linux】Linux下配置apache - 安装文件夹具体解释

    一,apache安装路径解释 默认安装路径   /var/apache2 # /etc/apache2/ # |-- apache2.conf # | `--  ports.conf # |-- mo ...

  7. 开源的许可证GPL、LGPL、BSD、Apache 2.0的通俗解释

    软件开发者要开源软件,不单单是开放源代码就可以了,选择一种许可证很重要,一个许可证之于软件就相当于价值观之于普通人,代表了这个软件的基本品性.一个错误的许可证选择可能会直接导致整个项目的失败. 各种开 ...

  8. PHP Apache shutdown unexpectedly启动错误解释及解决的方法

    在学PHP的时候,偶然发现XAMPP窗体Apache的启动出现错误,出现下面的错误提示: 9:52:41  [Apache] Attempting to start Apache app... 9:5 ...

  9. JSONObjectWithData方法里options參数选择解释

    NSJSONReadingMutableContainers  Specifies that arrays and dictionaries are created as mutable object ...

随机推荐

  1. dom解析器机制 web基本概念 tomcat

    0 作业[cn.itcast.xml.sax.Demo2]   1)在SAX解析器中,一定要知道每方法何时执行,及SAX解析器会传入的参数含义 1 理解dom解析器机制 1)dom解析和dom4j原理 ...

  2. 【HDOJ】4393 Throw nails

    水题,优先级队列. /* 4393 */ #include <iostream> #include <sstream> #include <string> #inc ...

  3. C#中的Marshal

    Const.MaxLengthOfBufferd的长度固定为0x2000   也就是8192 private bool SendMessage(int messageType, string ip, ...

  4. Hive 接口介绍(Web UI/JDBC)

    Hive 接口介绍(Web UI/JDBC) 实验简介 本次实验学习 Hive 的两种接口:Web UI 以及 JDBC. 一.实验环境说明 1. 环境登录 无需密码自动登录,系统用户名shiyanl ...

  5. ngui 脚本绘制sprite

    public GameObject _background; public UIAtlas atlas; private Dictionary<int, UISprite> _allCar ...

  6. poj 1259 Agri-Net(最小生成树)

    题目:http://poj.org/problem?id=1258 题意:模板题 和2485差不多 就是求相连后的最小值. #include <iostream> #include< ...

  7. c# equals与==的区别

    对于值类型,如果对象的值相等,则相等运算符 (==) 返回 true,否则返回 false.对于string 以外的引用类型,如果两个对象引用同一个对象,则 == 返回 true.对于 string ...

  8. Java [leetcode 28]Implement strStr()

    题目描述: Implement strStr(). Returns the index of the first occurrence of needle in haystack, or -1 if ...

  9. [Bhatia.Matrix Analysis.Solutions to Exercises and Problems]ExI.5.3

    Let $\scrM$ be a $p$-dimensional subspace of $\scrH$ and $\scrN$ its orthogonal complement. Choosing ...

  10. POJ 1236 Network of Schools 有向图强连通分量

    参考这篇博客: http://blog.csdn.net/ascii991/article/details/7466278 #include <stdio.h> #include < ...