【问题标题】:apache2 403 forbidden on parent directory父目录上禁止 apache2 403
【发布时间】:2017-06-27 21:47:52
【问题描述】:

当我尝试访问父目录时,比如 localhost/parent,它给了我 403 禁止。但是,如果我访问子目录,比如 localhost/parent/index.html,它就会通过。 我相信这是一个配置问题,但有人可以在这里指导我吗? 我尝试按照很多人的建议更改 apache2.conf,但它不起作用。(如下所示)

<Directory "your directory here">
   Order allow,deny
   Allow from all
   Require all granted
</Directory>

以下是错误日志的内容:

[Mon Jul 03 11:32:51.028149 2017] [autoindex:error] [pid 4899] [client 127.0.0.1:42462] AH01276: Cannot serve directory /var/www/html/hub/: No matching DirectoryIndex (index.php,index.cgi,index.pl,index.php,index.xhtml,index.htm) found, and server-generated directory index forbidden by Options directive

【问题讨论】:

  • 错误日志说明了什么?它可能是底层权限,而不是 Apache 配置。
  • 您希望在 /hub/ 中看到什么?目录列表?一些特定的文件?
  • 不,我希望它在集线器中加载 index.html 文件。

标签: apache2 config


【解决方案1】:

原来是配置文件问题,

sudo nano /etc/apache2/mods-enabled/dir.conf

将 index.php 作为第一个选项,它解决了问题

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-08-16
    • 2014-02-03
    • 1970-01-01
    • 1970-01-01
    • 2021-02-05
    • 2016-01-12
    • 2013-07-12
    相关资源
    最近更新 更多