"down for maintenance" plugin?


#1

I seem to remember there was a plugin for nginx would bypass all
requests and issue a single “down for maintenance” response, until a
certain file was removed/renamed.

I can’t find it on the wiki though. Was I imagining the plugin?

Phillip B Oldham
The Activity People
removed_email_address@domain.invalid mailto:removed_email_address@domain.invalid


Policies

This e-mail and its attachments are intended for the above named
recipient(s) only and may be confidential. If they have come to you in
error, please reply to this e-mail and highlight the error. No action
should be taken regarding content, nor must you copy or show them to
anyone.

This e-mail has been created in the knowledge that Internet e-mail is
not a 100% secure communications medium, and we have taken steps to
ensure that this e-mail and attachments are free from any virus. We must
advise that in keeping with good computing practice the recipient should
ensure they are completely virus free, and that you understand and
observe the lack of security when e-mailing us.


#2

We use this in the server section

if (-f /srv/www/maintenance.html) {
rewrite ^/(.*)$ /maintenance.html last;
break;
}

On Mon, Feb 16, 2009 at 11:30 AM, Phillip B Oldham <


#3

Does that work for all vhosts on the box? or do you have to add it into
each vhost config?

Atif G. wrote:

This e-mail has been created in the knowledge that Internet e-mail


best regards
Atif G.

Phillip B Oldham
The Activity People
removed_email_address@domain.invalid mailto:removed_email_address@domain.invalid


Policies

This e-mail and its attachments are intended for the above named
recipient(s) only and may be confidential. If they have come to you in
error, please reply to this e-mail and highlight the error. No action
should be taken regarding content, nor must you copy or show them to
anyone.

This e-mail has been created in the knowledge that Internet e-mail is
not a 100% secure communications medium, and we have taken steps to
ensure that this e-mail and attachments are free from any virus. We must
advise that in keeping with good computing practice the recipient should
ensure they are completely virus free, and that you understand and
observe the lack of security when e-mailing us.


#4

On Mon, Feb 16, 2009 at 12:04:38PM +0100, Atif G. wrote:

We use this in the server section

if (-f /srv/www/maintenance.html) {
rewrite ^/(.*)$ /maintenance.html last;
break;
}

location / {
try_files /maintenance.html
$uri $uri/index.html $uri.html
@mongrel;
}

location @mongrel {
proxy_pass http://mongrel;
}


#5

On Mon, Feb 16, 2009 at 4:23 AM, Igor S. removed_email_address@domain.invalid wrote:

if (-f /srv/www/maintenance.html) {
rewrite ^/(.*)$ /maintenance.html last;
break;
}

location / {
try_files /maintenance.html
$uri $uri/index.html $uri.html
@mongrel;
}

this is cool but i like #1 better…

you could make a single file enable maintenance mode for -all-
websites on the server.


#6

igor will try_files also work with 0.6.x?


#7

On 16-Feb-09, at 3:04 AM, Atif G. wrote:

We use this in the server section

if (-f /srv/www/maintenance.html) {
rewrite ^/(.*)$ /maintenance.html last;
break;
}

What I use is the following:
location / {
fastcgi_pass unix:/tmp/fcgi.socket;
include /etc/nginx/fastcgi_params;
}
error_page 502 /maint.html;

My entire site is served from a FastCGI process, so when it’s down or
is restarting, any requests get sent to maint.html. 502 is only
thrown when nginx can’t access the back-end gateway (either FastCGI or
a proxy), so your maintenance page will only be shown when you’re
actually doing maintenance.


#8

On Mon, Feb 16, 2009 at 07:35:15PM +0100, Atif G. wrote:

igor will try_files also work with 0.6.x?

There is a patch:
http://sysoev.ru/nginx/patch.try_files.0.6.35.1

I plan to add it in 0.6.x after some 0.7.x releases.