Last active
December 19, 2015 09:59
-
-
Save ricardokrieg/5936978 to your computer and use it in GitHub Desktop.
Nginx Maintenance Page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cp #{latest_release}/system/maintenance.html #{shared_path}/system/maintenance.html.not_active | |
# Swap in the maintenance page | |
namespace :web do | |
task :disable, roles: :web do | |
on_rollback {run "rm #{shared_path}/system/maintenance.html"} | |
run "if [[ !(-f #{shared_path}/system/maintenance.html) ]] ; then ln -s #{shared_path}/system/maintenance.html.not_active #{shared_path}/system/maintenance.html ; else echo 'maintenance page already up'; fi" | |
end | |
task :enable, roles: :web do | |
run "rm #{shared_path}/system/maintenance.html" | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
recursive_error_pages on; | |
if (-f $document_root/system/maintenance.html) { | |
return 503; | |
} | |
error_page 404 /404.html; | |
error_page 500 502 504 /500.html; | |
error_page 503 @503; | |
location @503 { | |
error_page 405 = /system/maintenance.html; | |
# Serve static assets if found. | |
if (-f $request_filename) { | |
break; | |
} | |
rewrite ^(.*)$ /system/maintenance.html break; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment