Apache2 -Indexes导致服务器失败

时间:2016-02-02 09:53:06

标签: apache apache2 directory-listing

我想阻止目录列表,在/etc/apache2/apache2.conf我有这个:

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
</Directory>

我在-之前添加了Indexes。当我重新启动服务器时,我在该行中收到错误。

我有这个版本:Apache/2.4.10之前我已经这样做了,以防止目录列表没有问题,但我不知道为什么会发生这种情况。

1 个答案:

答案 0 :(得分:1)

从文档中: https://httpd.apache.org/docs/2.4/mod/core.html#options

  

注意

     

Options与+或 - 混合使用无效语法,并且在服务器启动期间通过语法检查将被拒绝   中止。

所以而不是:

    Options -Indexes FollowSymLinks

您应该使用:

    Options -Indexes +FollowSymLinks