Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You shouldn't need to involve the backend (I.E., shouldn't use proxy pass) since your maintenance page should be a static html file that Nginx can serve directly.</p> <p>Assuming you have a setup configured as ...</p> <pre><code>server { listen 80; server_name example.com; root /path/to/webroot; # Regular locations etc ... } </code></pre> <p>Create a folder called "503_status" and put your maintenance page in there as "503.html".</p> <p>With that in place, create a file called "maintenance.default" under the Nginx directory with the following content ...</p> <pre><code>error_page 503 /503_status/503.html; # Candidate for redirection if not ending with one of these extensions. if ( $request_uri !~ \.(jpg|gif|png|css|js)$ ) { set $maint "Tr"; } # Candidate for redirection if not a request for the maintenance page if ( $request_uri !~ ^/maintenance/$ ) { set $maint "${maint}ue"; } # Redirect to a location where the status code will be issued if ( $maint = True ) { rewrite ^ /maintenance/ redirect; } # Due to Nginx quirk, issue the status code in a location context. # Make "internal" to prevent direct browsing. location /maintenance { internal; return 503; } # 503_status folder as "internal" so no direct browsing location 503_status { internal; alias /server/path/to/503_status/folder; } </code></pre> <p>Whenever you put to put the site into maintenance, just include the file as follows ...</p> <pre><code>server { listen 80; server_name example.com; root /path/to/webroot; include /server/path/to/maintenance.default; # Regular locations etc ... } </code></pre> <p>This will serve your maintenance page as well as any resources it needs (just make sure extension is in the list). The backend server does not come into play at all.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload