Correct way to setup maintenance page in nginx

Valentin V. Bartenev i at vbart.ru
Thu Nov 3 21:42:50 UTC 2011


On Friday 04 November 2011 01:02:11 António P. P. Almeida wrote:
> Why not this?
> 
> root /var/www;
> 
> location / {
> 
>    error_page 503 @unavailable;
> 
>    location @unavailable {
>       try_files /during_building.html @503;
>    }
> }
> 
> location @503 {
>    return 503;
> }
> 
> No need to use the if and the internal is implicit on the try_files.

First of all, named locations can be on the server level only.

And, how does a request get into @unavailable? Only after 503 has occurred.
But, what will cause it?

I think the main idea was: when we need to do some maintenance, we just create 
a specific file (probably with explaining message for users) and Nginx starts 
to return 503 on every request.

wbr, Valentin V. Bartenev



More information about the nginx mailing list