简体   繁体   English

Apache自定义错误页面

[英]Apache custom error page

I'm trying to use htpassd for my sites, and whitelist a couple of ips. 我正在尝试将htpassd用于我的网站,并将几个ips列入白名单。 This works perfectly, but if the user presses the cancel button, it shows the standard apache 401 error page. 这可以正常工作,但是如果用户按下“取消”按钮,则会显示标准的apache 401错误页面。

With ErrorDocument I am supposed to cusomize it, so I placed a html file auth.html in /var/www/auth.html. 我应该使用ErrorDocument对其进行自定义,因此我在/var/www/auth.html中放置了一个html文件auth.html。 If I go to my.server.ip.address/auth.html I see the page. 如果我转到my.server.ip.address / auth.html,则会看到该页面。

But in combination with ErrorDocument I get the standard message with: 但是与ErrorDocument结合使用时,我得到的标准消息如下:

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

How can I debug this, nothing shows up in /var/log/apache/error.log 我该如何调试,在/var/log/apache/error.log中什么都没有显示

This is the piece of apache conf I use to set it all up, it's included via /etc/apache2/conf.d on my debian machine. 这是我用来设置所有内容的apache conf,它通过我的debian机器上的/etc/apache2/conf.d包含在内。

<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

Make sure that /auth.html is readable by the apache user 确保apache用户可以读取/auth.html

and this document should not be in protected directory. 并且此文档不应位于受保护的目录中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM