# 在server块中添加
error_page 403 /403.html;
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;

# 在location /中添加
proxy_intercept_errors on;