Skip to content

Instantly share code, notes, and snippets.

@trobrock
Created April 22, 2011 17:43
Show Gist options
  • Save trobrock/937199 to your computer and use it in GitHub Desktop.
Save trobrock/937199 to your computer and use it in GitHub Desktop.
location / {
if (-f $document_root/system/maintenance.html) {
return 503;
}
try_files $uri $uri/index.html @proxy;
}
error_page 503 @503;
location @503 {
# Serve static assets if found when in maintenance mode.
if (-f $request_filename) {
break;
}
# Serve the maintenance page if we're in maintenance mode.
if (-f $document_root/system/maintenance.html) {
rewrite ^(.*)$ /system/maintenance.html break;
}
# This is a normal 503 so serve that page.
rewrite ^(.*)$ /503.html break;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment