Ruby Forum Mongrel > how to get mongrel to use maintenance.html file?

Posted by James Testa (axees335)
on 31.03.2008 18:28
Does someone know how to tell mongrel_rails to read the
public/system/maintenance.html file?
Posted by Nate Vack (Guest)
on 31.03.2008 18:40
(Received via mailing list)
You'd probably ask Apache / ngnix to do that, actually, via some
mod_rewrite-fu I can't muster this morning :/

Cheers,
-Nate
Posted by Kirk Haines (Guest)
on 31.03.2008 20:41
(Received via mailing list)
On Mon, Mar 31, 2008 at 10:34 AM, Nate Vack <njvack@wisc.edu> wrote:
> You'd probably ask Apache / ngnix to do that, actually, via some
> mod_rewrite-fu I can't muster this morning :/
>
> Cheers,
> -Nate
>
>
> On Mon, Mar 31, 2008 at 11:28 AM, James Testa <lists@ruby-forum.com> wrote:
> > Does someone know how to tell mongrel_rails to read the
> >  public/system/maintenance.html file?

Generally, yes.

If you are doing some sort of maintenance, you probably want that
served at the highest level possible.  i.e. at the web server level.

Swiftiply w/ rewrite support (totally experimental, but will probably
end up in a release soon)

:rewrites:
- :match: "*"
  :sub: "/public/system/maintenance.html"


Apache:

RewriteEngine On
RewriteRule * /public/system/maintenance.html
(or something similar; unless you do it a lot, always check the
rewrite rule docs when writing them)



Kirk Haines
Posted by Dave Cheney (Guest)
on 31.03.2008 23:59
(Received via mailing list)
For nginx, try something like this,

error_page   503          /maintenance.html;

location /maintenance.html {

}

location / {
    if ( -f $document_root/system/maintenance.html ) {
       return 503;
    }

    if (!-f $request_filename) {
       rewrite ^(.+)$ $uri break;
       proxy_pass http://mongrel_app;
   }
}

This is slightly different to the configuration that is out there for
doing /maintenance.html because those return a 200 code in maintenance
mode, which upsets paypal

Cheers

Dave