【问题标题】:Apache2 Option index on centos 6.3centos 6.3 上的 Apache2 选项索引
【发布时间】:2013-01-10 05:23:12
【问题描述】:

在新安装的 Centos 6.3 上

我从 Ubuntu 导入了虚拟主机的配置。这是一段配置

DocumentRoot /otherhome/test.cofares.net
ServerName test.cofares.net

<Directory "/otherhome/test.cofares.net">
  allow from all
  Options +Indexes
</Directory>

http://test.cofares.net的请求我在错误日志中得到以下错误

Directory index forbidden by Options directive: /otherhome/test.cofares.net/

为子目录http://test.cofares.net/test工作的目录索引正常

任何建议缺少什么?

相同的配置适用于 Ubuntu Server 12.04。

问候

【问题讨论】:

    标签: apache2 centos option virtualhost indexing


    【解决方案1】:

    试试这个。并确保申请后重启apache:

    <Directory "/otherhome/test.cofares.net">
      Options +Indexes FollowSymLinks
      AllowOverride all
      Order Allow, Deny
      Allow from All
      Satisfy All
    </Directory>
    

    也许用Satisfy Any 试试这个:

    <Directory "/otherhome/test.cofares.net">
      Options +Indexes FollowSymLinks
      AllowOverride all
      Order Allow, Deny
      Allow from All
      Satisfy Any
    </Directory>
    

    编辑:那些似乎不起作用?然后试试这个。注意我正在设置整个&lt;VirtualHost&gt; 指令并从&lt;Directory&gt; 指令中删除引号:

    <VirtualHost *:80>
       DocumentRoot /otherhome/test.cofares.net
       ServerName test.cofares.net
    
       <Directory /otherhome/test.cofares.net>
         Options Indexes FollowSymLinks
         Allow from All
       </Directory>
    
    </VirtualHost>
    

    【讨论】:

    • 挖掘后,我在welcome.conf中发现了有问题的conf,我将其删除,现在可以了,感谢您的帮助 Options -Indexes ErrorDocument 403 /error/noindex.html
    • 我想说的是,CentOS 和 Ubuntu 处理虚拟主机配置的方式并没有太多特殊之处,所以如果上述方法都不起作用,那它一定是别的东西。但很高兴它最终成功了!
    【解决方案2】:

    经过一番挖掘,我注意到这是一个全局规则(在 conf.d/welcome.conf 中),它阻止索引任何虚拟服务器的 / 目录

    删除它现在可以了

    这是必须改变的规则

    <LocationMatch "^/+$">
      Options -Indexes
      ErrorDocument 403 /error/noindex.html
    </LocationMatch>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-01-09
      • 2012-08-09
      • 2012-08-09
      • 2013-06-05
      • 2011-07-05
      • 2013-06-06
      • 1970-01-01
      • 2013-12-08
      相关资源
      最近更新 更多