Static error page served by nginx when my application is down
- by dreeves
If my (Rails) application is down or undergoing database maintenance or whatever, I'd like to specify at the nginx level to server a static page. So every URL like http://example.com/* should server a static html file, like /var/www/example/foo.html.
Trying to specify that in my nginx config is giving me fits and infinite loops and whatnot.
I'm trying things like
location / {
root /var/www/example;
index foo.html;
rewrite ^/.+$ foo.html;
}
How would you get every URL on your domain to serve a single static file?