0
以下是上游块我已经在Nginx的Nginx的:一次性自定义错误页,没有活的上游,而连接到上游
upstream sample{
server abc1.example.com down;
server abd2.example.com down;
}
在这种情况下,错误日志显示以下错误:
no live upstreams while connecting to upstream, client: 10.196.90.83, server: abc_sample_a , request: "GET/HTTP/1.1", upstream: "http://sample/", host: "abc_sample_a
目前,收到的错误代码是502.但是我想返回503错误代码。
我的上游块是在一个单独的文件,并通过许多其他文件使用proxy_pass指令称为。我不想重新发布这个错误代码的所有文件。而且,只有在所有服务器都关闭的情况下,它才需要回退。不是它应用程序本身返回502. – Vishnu
您可以将此代码添加到http块的主nginx配置中,以便处理您的所有网站。 – user3655534
你也可以设置:\t proxy_intercept_errors on;比nginx不会处理与error_page的应用程序错误。 http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_intercept_errors – user3655534