title: Show a custom 503 page if upstream is down
body: <p>I am using nginx as a frontend to an apache server. The config file looks like:</p>
  
  <pre><code>upstream apache {
      server localhost:8000;
  }
  
  server {
      listen 80;
      error_page 503 /www/static/503.html;
  
      # need some magic here #
  
      location /static/ {
          root /www/static/;
      }
  
      location / {
          proxy_path http://apache/;
      }
  }
  </code></pre>
  
  <p>For now, when apache is down, I receive a plain 502 page generated by nginx. How to make it serve my custom error page and return status code 503 which is more relevant in this situation?</p>