Correct way to setup maintenance page in nginx

Valentin V. Bartenev i at vbart.ru
Thu Nov 3 20:18:03 UTC 2011


On Thursday 03 November 2011 22:30:00 Quintin Par wrote:
[...]
> This method outside of `location` directive
> 
>  error_page 503 /var/www/during_build.html;
> 
>  ## System Maintenance (Service Unavailable)
>  if (-f  /var/www/during_build.html) {
>      return 503;
>  }
> 
> Is also not working. Nginx just returns 503 without the custom page.
> 
> What is the correct way to show system down pages?
> 

Try this one:

    error_page 503 /during_build.html;

    location / {

        if (-f /var/www/during_build.html) {
            return 503;
        }

    }

    location = /during_build.html {
        root /var/www/;
        internal;
    }


wbr, Valentin V. Bartenev



More information about the nginx mailing list