new nginx module: notice

Keith Rarick kr at essembly.com
Tue Jun 19 09:46:25 MSD 2007


On 6/16/07, Igor Sysoev <is at rambler-co.ru> wrote:
>     error_page  503  =200  /notice.html;
>
>     location / {
>
>         if (-f /var/www/notice.html) {
>             return 503;
>         }
>
>         ...
>     }
>
>     location = /notice.html {
>         root /var/downtime;
>     }

Thanks! Unfortunately, I over-simplified the situation a bit in my
previous mail. We actually have three different files we want to
display during downtime, depending on the url. So we do:

if (-f /var/downtime/notice.html) {
  rewrite ^/health(.*)$ /health.txt break;
  rewrite ^/facebook/(.*)$ /fb-notice.fbml break;
  rewrite ^(.*)$ /notice.html break;
  break;
}

location = /health.txt {
  notice /var/downtime/health.txt;
  notice_type text/plain;
  break;
}
location = /fb-notice.fbml {
  notice /var/downtime/fb-notice.fbml;
  break;
}
location = /notice.html {
  notice /var/downtime/notice.html;
  break;
}

Is there a way to use error_page 503 this way for more than one file?

Have a good vacation!

kr





More information about the nginx mailing list