title: nginx not serving my error_page
body: <p>I have a Sinatra application hosted with Unicorn, and nginx in front of it. When the Sinatra application errors out (returns 500), I'd like to serve a static page, rather than the default "Internal Server Error". I have the following nginx configuration:</p>
  
  <pre><code>server {
    listen 80 default;
    server_name *.example.com;
    root /home/deploy/www-frontend/current/public;
  
    location / {
      proxy_pass_header Server;
      proxy_set_header Host $http_host;
      proxy_redirect off;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Scheme $scheme;
      proxy_connect_timeout 5;
      proxy_read_timeout 240;
      proxy_pass http://127.0.0.1:4701/;
    }
  
    error_page 500 502 503 504 /50x.html;
  }
  </code></pre>
  
  <p>The error_page directive is there, and I have sudo'd as www-data (Ubuntu) and verified I can <code>cat</code> the file, thus it's not a permission problem. With the above config file, and <code>service nginx reload</code>, the page I receive on error is still the same "Internal Server Error".</p>
  
  <p>What's my error?</p>