# 开启代理错误拦截,捕获后端不可达产生的5xx错误
proxy_intercept_errors on;
# 将502/503/504错误统一转为503维护状态,跳转到本地维护页
error_page 502 503 504 =503 /maintenance.html;
# 维护页内部路由,禁止外部直接访问
location = /maintenance.html {
internal;
# 禁止缓存维护页,避免服务恢复后仍显示维护中
add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate" always;
# 告诉搜索引擎60秒后重试,保护SEO权重
add_header Retry-After "60" always;
}