禁止显示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. Eclipse优化

    未特别说明,以下均处理在Window->Preferences下 General列表下 Startup and Shutdown可以去掉一些不必要的启动项 怎样才能知道哪些启动项有用呢?我现在把 ...

  2. Spring-Data-JPA学习

    Spring-Data-JPA结构图 网址: http://blog.sina.com.cn/s/blog_667ac0360102ecsf.html

  3. poj 2049 Finding Nemo(优先队列+bfs)

    题目:http://poj.org/problem?id=2049 题意: 有一个迷宫,在迷宫中有墙与门 有m道墙,每一道墙表示为(x,y,d,t)x,y表示墙的起始坐标d为0即向右t个单位,都是墙d ...

  4. mvc源码解读(20)-controller和view之查找view

    很多时候在mvc项目中我们需要去扩展自己的视图引擎,大概看起来应该下面这个样子的: public class RazorEngineExpand : RazorViewEngine { private ...

  5. Socket编程(九)

    此为网络编程的一个系列,后续会把内容补上.....

  6. OK335xS Qt network hacking

    /********************************************************************** * OK335xS Qt network hacking ...

  7. Welcome to Linux From Scratch!

    /**************************************************************************** * Welcome to Linux Fro ...

  8. 几种通讯协议的比较RMI > Httpinvoker >= Hessian >> Burlap >> web service

    一.综述本文比较了RMI,Hessian,Burlap,Httpinvoker,web service等5种通讯协议的在不同的数据结构和不同数据量时的传输性能.RMI是java语言本身提供的远程通讯协 ...

  9. 转载-KMP算法前缀数组优雅实现

    转自:http://www.cnblogs.com/10jschen/archive/2012/08/21/2648451.html 我们在一个母字符串中查找一个子字符串有很多方法.KMP是一种最常见 ...

  10. UVAlive3662 Another Minimum Spanning Tree 莫队算法

    就是莫队的模板题 /* Memory: 0 KB Time: 1663 MS Language: C++11 4.8.2 Result: Accepted */ #include<cstdio& ...