Handle all 500 errors locally, and serve maintenance page from local file
server {
# Handle all 500 errors locally, serve maintenance page from local file
error_page 500 501 502 503 504 505 506 507 508 509 510 511 = @maintenance;
# sadly no wildcard
location @maintenance {
root html/Maintenance; # serve from local files
try_files /index.html =502; # try serve index.html then fallback to standard 502 error response
}
location / {
proxy_pass http://prod
}
}