nginx maintenance page

Sean Allen sean at monkeysnatchbanana.com
Thu Jul 17 17:19:12 MSD 2008


On Jul 17, 2008, at 5:36 AM, Thomas wrote:

> On Thu, Jul 17, 2008 at 11:34 AM, Thomas <iamkenzo at gmail.com> wrote:
>> It's simply a rewrite rule that will deliver the maintenance page (if
>> it exists) to all incoming request. You still need to design your own
>> nicely crafted maintenance page though.
>>
>
> My bad, it is not a rewrite rule! It is a rule (no rewrite) for Nginx
> to look for a maintenance page, and if it exists, it sends it back no
> matter which request is coming in. A rewrite rule is not even needed.
>
hmm yes, but would that one prevent any images being on the page?
looks pretty much like ours... in its general idea...

if ( -f $document_root/.maintenance )
{
   set $maintenance 1;
}

if ( $uri ~ ^/maintenance/ )
{
   set $maintenance 0;
}

if ( $maintenance )
{
   rewrite (.*) /maintenance/index.html last;
}

if file exists, serve maintenance. ( with bypass for any other files  
in /maintenance ) directory.





More information about the nginx mailing list