【问题标题】:Apache custom error pageApache 自定义错误页面
【发布时间】:2014-02-28 20:45:16
【问题描述】:

我正在尝试将 htpassd 用于我的网站,并将几个 ip 列入白名单。这很完美,但是如果用户按下取消按钮,它会显示标准的 apache 401 错误页面。

我应该对 ErrorDocument 进行自定义,所以我在 /var/www/auth.html 中放置了一个 html 文件 auth.html。如果我转到 my.server.ip.address/auth.html 我会看到该页面。

但结合 ErrorDocument 我得到标准消息:

Additionally, a 401 Authorization Required error was encountered while trying to use an ErrorDocument to handle the request.

如何调试,/var/log/apache/error.log 中没有显示任何内容

这是我用来设置它的 apache conf,它通过 /etc/apache2/conf.d 包含在我的 debian 机器上。

<Directory /var/www/ >
    Allow from all
    Satisfy Any
</Directory>

<Directory /home/goodmorning >
Order deny,allow
Deny from all
AuthName "Wachtwoord opvragen kan via support@company.nl"
AuthUserFile /home/hg/htpasswd
AuthType Basic
Require valid-user
Allow from w.x.y.z
Allow from w.x.y.z
Allow from w.x.y.z
Satisfy Any

</Directory>
ErrorDocument 401 /auth.html

【问题讨论】:

    标签: apache .htpasswd apache2.4


    【解决方案1】:

    确保 /auth.html 可以被 apache 用户读取

    并且此文档不应在受保护的目录中。

    【讨论】:

    • 是的,我什至做了 chmod 777
    • 这个错误页面是在保护目录还是其他地方
    猜你喜欢
    • 2011-06-07
    • 2019-01-18
    • 2014-02-22
    • 2013-02-13
    • 1970-01-01
    • 1970-01-01
    • 2015-08-26
    • 2013-08-26
    • 2016-04-25
    相关资源
    最近更新 更多