webserver – 使用nginx返回自定义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;
}

编辑:
修正了错误页面代码从504到403,但我仍然遇到同样的问题

最佳答案
我在来到这里之前做了很多谷歌搜索,但刚刚做了一些,在5分钟内得到了答案:P

似乎我不是唯一有这个问题的人:

http://www.cyberciti.biz/faq/unix-linux-nginx-custom-error-403-page-configuration/

似乎我认为对我的错误页面的访问被阻止是正确的.

相关文章

文章浏览阅读3.7k次,点赞2次,收藏5次。Nginx学习笔记一、N...
文章浏览阅读1.7w次,点赞14次,收藏61次。我们在使用容器的...
文章浏览阅读1.4k次。当用户在访问网站的过程中遇到404错误时...
文章浏览阅读2.7k次。docker 和 docker-compose 部署 nginx+...
文章浏览阅读1.3k次。5:再次启动nginx,可以正常启动,可以...
文章浏览阅读3.1w次,点赞105次,收藏182次。高性能:Nginx ...