【问题标题】:nginx custom 404 error page not workingnginx自定义404错误页面不起作用
【发布时间】:2017-10-05 09:14:29
【问题描述】:

我的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;
            }

    }

}

我做错了什么?

【问题讨论】:

  • 您当前的配置在以下位置查找文件:/var/www/html/index.html/index.html 尝试:root /var/www/html;
  • @RichardSmith,改变了它。还是不行。

标签: node.js nginx


【解决方案1】:

想通了!我有一个包含指令,其中包含另一个 conf 文件,该文件具有覆盖我上面发布的文件中的服务器指令。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-08-12
    • 2015-09-22
    • 1970-01-01
    • 2010-11-04
    • 2015-04-17
    • 2011-12-23
    相关资源
    最近更新 更多