nginx maintenance page

Tyler Kovacs tyler.kovacs at
Wed Jul 16 03:33:22 MSD 2008

> If I kill the Rails app I get a 502 Bad Gateway error

Short answer:  run /etc/init.d/nginx reload after creating
/system/maintenance.html (and do it again after removing the maintenance file)

It sounds like your Rails processes are serving the maintenance page.  When your
Rails processes are down nginx appears to be still trying to proxy the request
to Rails - which results in a 502.  That implies that nginx is not attempting to
serve the maintenance.html page at all.  This has happened to me in the past and
I found that I needed to reload nginx.conf for it to pick up a newly created
maintenance file.

If that doesn't work, then compile nginx with debugging enabled (./configure
--with-debug) and add debug_http to the end of your error_log configuration. 
Then you can watch the rewriting rules in action by tailing your error.log.

More information about the nginx mailing list