nginx自定义404错误页面无效

时间:2017-10-04 17:57:09

标签: node.js nginx

我的nginx文件如下。我正在尝试将所有404请求重定向到我的index.html。在客户端,我有自定义客户端路由逻辑,将处理URL。

但默认的nginx 404页面仍然被调用。 (例如:转到http://branches-app.com/Languages/Spanish)。

http {
   .......
    server {
            listen [::];
            listen 0.0.0.0;
            proxy_intercept_errors on;
            error_page 404 /index.html;
            location = /index.html {
                    root /var/www/html;
                    allow all;
            }

    }

}

我做错了什么?

1 个答案:

答案 0 :(得分:0)

想出来!我有一个include指令,包括另一个conf文件,它有一个服务器指令覆盖了我在上面发布的文件中。