Correct way to setup maintenance page in nginx

Quintin Par quintinpar at
Thu Nov 3 18:30:00 UTC 2011

Hi all,

I tried using this method with `try_files`. Didn’t work. Also the HTTP
status code(503) is not being set.

    location / {
        try_files /var/www/during_build.html @maintenance;
            proxy_pass  http://localhost:82;

    location @maintenance {
          return 503;

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?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list