Skip to content

Instantly share code, notes, and snippets.

@binary1230
Created November 4, 2015 14:11
Show Gist options
  • Save binary1230/186c7ce8d79601e04b42 to your computer and use it in GitHub Desktop.
Save binary1230/186c7ce8d79601e04b42 to your computer and use it in GitHub Desktop.
maintenance page on nginx
# if /var/www/maintenance.html exists, don't use the proxy, instead, redirect everything to the maintenance page
# if it doesn't exist, proceed as normal
server #WHATEVER# {
location #WHATEVER# {
if (-f /var/www/maintenance.html) {
return 503;
}
# REST OF NORMAL STUFF
}
error_page 503 @maintenance;
location @maintenance {
root /var/www/;
rewrite ^(.*)$ /maintenance.html break;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment