【发布时间】:2018-05-21 19:33:51
【问题描述】:
我正在使用 nginx 作为我的项目的代理服务器。如果我的应用因维护而离线,我想显示一个后备页面。到目前为止,这工作正常。唯一的问题是,服务器响应 502 错误代码 - 这是有道理的。但是,如何在我的后备中将其更改为 503 路由?
server {
listen 80;
error_page 500 502 503 504 @fallback;
location / {
proxy_pass http://0.0.0.0:3000;
}
location @fallback {
// I need this to answer with a status of 503 instead of a 502
root /srv/my-project/static;
try_files /fallback.html;
}
}
【问题讨论】:
标签: nginx