【发布时间】: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