Skip to content

Instantly share code, notes, and snippets.

@mm53bar
Created April 13, 2012 01:39
Show Gist options
  • Save mm53bar/2372728 to your computer and use it in GitHub Desktop.
Save mm53bar/2372728 to your computer and use it in GitHub Desktop.
Instead of using capistrano's deploy:web:disable (http://capitate.rubyforge.org/recipes/deploy-web.html#deploy:web:disable), why not just have the maintenance page displayed anytime the upstream server isn't available?
...
try_files $uri.html $uri @app;
error_page 502 503 =503 @maintenance;
location @app {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://app_server;
}
location @maintenance {
try_files /503.html =503;
}
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment