3

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

1 Answer 1

4

"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:

root /home/igel/www/stage.example.com/current/public; error_page 503 /system/maintenance.html; location / { if ( -e /system/maintenance.html ) { return 503; } } location = /system/maintenance.html { } 
1
  • Thanks, I modified your code a little, though, since the rails app didn't work, if I didn't specify passenger_enabled within the location: gist.github.com/1965393 Commented Mar 3, 2012 at 10:20

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.