如何让nginx反向代理让503错误页面传递给客户端?

Col*_*inM 0 nginx reverse-proxy magento

我在 nginx 后面运行 Magento(电子商务 PHP 应用程序)作为运行 PHP 应用程序的 Apache 的反向代理。静态内容由 nginx 直接提供。Magento 有一个“维护模式”,它使用 503 HTTP 响应。使用我的配置,当启用维护模式时,nginx 返回一个带有 500 响应的空白页面,而不是带有 503 响应的 Magento 良好的维护模式页面。如何让nginx让503页面传递给客户端?

这是我的 nginx 配置:

上游 examplecluster { 服务器 1.2.3.4:80; }
服务器 {
  听 1.2.3.5:80;
  server_name www.example.com;
  根/var/www/example.com/www;

  # 安全
  位置 ~ (/(app/|includes/|lib/|pkginfo/|var/|report/config.xml|downloader/(pearlib|template|Maged)/)|/\.svn/|/\.ht.+ ){
    返回404;
  }

  位置 ~ \.php$ {
    proxy_pass http://examplecluster;
    proxy_redirect 默认;
  }

  # 静态内容
  地点 / {
    try_files $uri @apache;
    7d 到期;
  }

  #阿帕奇
  位置@apache {
    proxy_pass http://examplecluster;
    proxy_redirect 默认;
  }
}

Col*_*inM 7

事实证明,在提供 503 页面时确实存在错误,因此 nginx 毕竟正确转发了响应。

但是,相关的 nginx 设置proxy_intercept_errors off;已经是默认设置了。