Skip to content

Commit

Permalink
Merge pull request #142 from RogerE/maintenance-nginx-config
Browse files Browse the repository at this point in the history
Added Nginx configuration description for `deploy:web:disable`.
  • Loading branch information
leehambley committed Feb 19, 2012
2 parents a66ea8d + 6bbbcc5 commit ad0422a
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/capistrano/recipes/deploy.rb
Expand Up @@ -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
Expand All @@ -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']
Expand Down

0 comments on commit ad0422a

Please sign in to comment.