Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Added Nginx configuration description for deploy:web:disable #142

Merged
merged 1 commit into from

2 participants

Roger Ertesvåg Lee Hambley
Roger Ertesvåg

Added description of how to configure Nginx to display maintenance page and return status code 503 after deploy:web:disable is executed.

Lee Hambley
Owner

Thanks @RogerE, there's been some discussion about moving the web:disable to a separate gem, but I'll pull this either into mainline, or fabricate another light gem containing the web disable tasks.

Lee Hambley leehambley merged commit ad0422a into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 12 additions and 1 deletion.
  1. +12 −1 lib/capistrano/recipes/deploy.rb
13 lib/capistrano/recipes/deploy.rb
View
@@ -542,7 +542,7 @@ def try_runner(*args)
warn <<-EOHTACCESS
- # Please add something like this to your site's htaccess to redirect users to the maintenance page.
+ # Please add something like this to your site's Apache htaccess to redirect users to the maintenance page.
# More Info: http://www.shiftcommathree.com/articles/make-your-rails-maintenance-page-respond-with-a-503
ErrorDocument 503 /system/#{maintenance_basename}.html
@@ -551,6 +551,17 @@ def try_runner(*args)
RewriteCond %{DOCUMENT_ROOT}/system/#{maintenance_basename}.html -f
RewriteCond %{SCRIPT_FILENAME} !#{maintenance_basename}.html
RewriteRule ^.*$ - [redirect=503,last]
+
+ # Or if you are using Nginx add this to your server config:
+
+ if (-f $document_root/system/maintenance.html) {
+ return 503;
+ }
+ error_page 503 @maintenance;
+ location @maintenance {
+ rewrite ^(.*)$ /system/maintenance.html last;
+ break;
+ }
EOHTACCESS
reason = ENV['REASON']
Something went wrong with that request. Please try again.