【问题标题】:apache 2.4.10 error 403 on aliases别名上的 apache 2.4.10 错误 403
【发布时间】:2015-08-07 18:24:48
【问题描述】:

我在 debian7 上将我的 apache 服务器从 2.2.x 版本更新到 2.4.10,但我遇到了多个虚拟主机的问题。当我尝试加载页面时,我禁止了 [403] 错误。如果我只启用一个别名,则页面工作正常,当我尝试启用另一个页面时,我收到 403 错误。我添加到所有配置中要求全部授予。

我做错了什么?

别名 1 的代码:

<VirtualHost example.com:3099>
DocumentRoot /home/ftp/example.com
alias alias1 /home/ftp/example.com/alias1/>
<Directory /home/ftp/example.com/alias1/>
        Options +Indexes +FollowSymLinks +MultiViews
        AllowOverride None
        Require all granted
</Directory>
</VirtualHost>

别名 2 的代码:

<VirtualHost example.com:3099>
    DocumentRoot /home/ftp/example.com
    alias alias2 /home/ftp/example.com/alias2/>
    <Directory /home/ftp/example.com/alias2/>
            Options +Indexes +FollowSymLinks +MultiViews
            AllowOverride None
            Require all granted
    </Directory>
    </VirtualHost>

更新 1 在 /etc/apache2/apache2.conf 我有

<Directory />
        Options FollowSymLinks
        AllowOverride none
        Require all denied
</Directory>

如果我将拒绝更改为授予,错误 403 会消失,但我可以访问 /home/ftp/example.com 中的所有子目录,即使它们没有虚拟主机别名。

更新 2 我有错误,当我在这里写帖子时,在服务器配置中我有正确的目录位置。

【问题讨论】:

    标签: apache configuration virtualhost virtual-hosts


    【解决方案1】:

    这些参数不匹配,所以路径被禁止。看最后一个字符:

      alias alias2 /home/ftp/example.com/alias2/>
        <Directory /home/ftp/example.com/alias1/>
    

    【讨论】:

    • 我只有在这里发布错误,在服务器配置中我有正确的路径
    • 别名路径的末尾仍有&gt;。这真的是您在 Apache 配置文件中的内容吗? Alias 的 URL 路径的第一个参数通常也有一个前导 /。你有什么理由不这样做?
    猜你喜欢
    • 2015-03-17
    • 1970-01-01
    • 2015-03-14
    • 1970-01-01
    • 2013-10-17
    • 1970-01-01
    • 2012-06-28
    • 2011-10-12
    • 2015-01-25
    相关资源
    最近更新 更多