There are three pieces that must be in place in order for your custom error page to display instead of the generic “Bad Gateway” error.
-
You must create an html file named something like “500.html” and place it in the root. In the case of Rails running behind Nginx, this means putting it at public/500.html.
-
You must have a line in your config file that points at least the 502 errors to that 500.html page like this:
error_page 502 /500.html; -
You must have a location block for /500.html in your config file. If your root is already defined, this block can be empty. But the block must exist nonetheless.
location /500.html{ }