Min*_*int 8 webserver nginx custom-error-pages http-status-code-403
我试图在发生403错误时在/temp/www/error403.html中显示错误页面.
这应该是每当用户尝试通过https(ssl)访问该站点并且它的IP位于blovkips.conf文件中时,但此时它仍然显示nginx的默认错误页面.我有其他服务器相同的代码(没有任何阻止),它的工作原理.
是否阻止IP访问自定义403页面?如果是这样,我如何让它工作?
server {
# ssl
listen 443;
ssl on;
ssl_certificate /etc/nginx/ssl/site.in.crt;
ssl_certificate_key /etc/nginx/ssl/site.in.key;
keepalive_timeout 70;
server_name localhost;
location / {
root /temp/www;
index index.html index.htm;
}
# redirect server error pages to the static page
error_page 403 /error403.html;
# location = /error403.html {
# root /temp/www;
# }
# add trailing slash if missing
if (-f $document_root/$host$uri) {
rewrite ^(.*[^/])$ $1/ permanent;
}
# list of IPs to block
include blockips.conf;
}
Run Code Online (Sandbox Code Playgroud)
编辑: 更正了错误页面代码从504到403,但我仍然有同样的问题
在来到这里之前,我做了很多谷歌搜索,但是现在,在5分钟内我做了更多的回答:P
看来我不是唯一遇到此问题的人:
error_page 403 /e403.html;
location = /e403.html {
root html;
allow all;
}
Run Code Online (Sandbox Code Playgroud)
http://www.cyberciti.biz/faq/unix-linux-nginx-custom-error-403-page-configuration/
似乎我认为是对我的错误页面的访问被阻止了,这是对的。
归档时间: |
|
查看次数: |
34580 次 |
最近记录: |