禁止显示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. Ubuntu12.04下arm交叉编译环境的建立

    http://blog.csdn.net/heyangya2009/article/details/5424376 备注:ubuntu12.04+Android+Real6410 在主机上用来编译其他 ...

  2. [swustoj 679] Secret Code

    Secret Code 问题描述 The Sarcophagus itself is locked by a secret numerical code. When somebody wants to ...

  3. 关于 tomcat 集群中 session 共享的三种方法

    前两种均需要使用 memcached 或redis 存储 session ,最后一种使用 terracotta 服务器共享. 建议使用 redis,不仅仅因为它可以将缓存的内容持久化,还因为它支持的单 ...

  4. 在 Azure 中使用公用 IP 创建多 NIC VM

    Russ Slaten  2014年 11 月 18日下午 4点 我们最近宣布了支持具有多个网络接口控制器 (NIC) 的虚拟机 (VM).我仍在努力了解此功能适用的所有新场景,但首先,我希望亲自测试 ...

  5. Java [leetcode 18]4Sum

    问题描述: Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d ...

  6. sharepoint 2010 页面添加footer方法 custom footer for sharepoint 2010 master page

    转:http://blog.csdn.net/chenxinxian/article/details/8720893 在sharepoint 2010的页面中,我们发现,没有页尾,如果我们需要给页面添 ...

  7. 关于 mkimage

    在嵌入式系统中,Linux内核和根文件系统一般都与bootloader一起烧写在flash芯片中,系统启动后,bootloader将Linux内核压缩到RAM中,并把压缩的根文件系统复制到RAM中,然 ...

  8. Skyline学习教程

    转自:http://yunjinzh.blog.sohu.com/165279318.html 当初开设这个blog的初衷就是将PPT与专业技术进行结合 将专业技术的介绍更加艺术化 但是之前一直都没有 ...

  9. expunge

    expunge 擦掉: 除去: 删去: 消除 1. The experience was something he had tried to expunge from his memory. 他曾努力 ...

  10. Codeforces 633 C Spy Syndrome 2 字典树

    题意:还是比较好理解 分析:把每个单词反转,建字典树,然后暴力匹配加密串 注:然后我就是特别不理解,上面那种能过,而且时间很短,但是我想反之亦然啊 我一开始写的是,把加密串进行反转,然后单词正着建字典 ...