I try to set up a maintenance page for my rails app, using this snipplet.
error_page 503 /system/maintenance.html;
if (-f $document_root/system/maintenance.html) {
return 503;
}
This works as far as the presence of the maintenance.html causes the webserver to return a 503. But it returns the minimal nginx default error_page, not my maintenance.html. Why?
nginx 1.0.12 on Ubuntu 10.04 LTS
The complete vhost configuration: https://gist.github.com/1948225
"if" and "return" directives are the part of ngx_rewrite_module. Since you declare such condition at server level you don't live a chance to nginx to handle error_page.
Make your config clear: