Nginx reverse proxy: How to serve 'back soon' html file while backend server restarts

user1561108 asked:

I have a WSGI server behind by nginx. Say I bring the WSGI instance down for maintenance/update, is there a nice way of nginx automatically serving up any requests to that application with a specified HTML file?

My answer:


Create a static page /50x.html with your desired content, and then add something like this to your nginx configuration:

error_page 502 503 504 /50x.html;

The error_page directive is used to override nginx’s internal error pages.


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.