Last active
July 10, 2017 12:46
-
-
Save hasmukhrathod/a1fe6e0bd081b2b32c5f706010ca6abb to your computer and use it in GitHub Desktop.
Maintenance Mode on-off
This file contains hidden or 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
/etc/httpd/conf/httpd.conf | |
<VirtualHost *:80> | |
ServerName ELB/DNS | |
RackEnv production | |
DocumentRoot /www/XYZ/current/public | |
<Directory /www/XYZ/current/public> | |
AllowOverride all | |
Options -MultiViews | |
Options Indexes ExecCGI FollowSymLinks | |
Header always append X-Frame-Options SAMEORIGIN | |
</Directory> | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
#RewriteCond %{REMOTE_ADDR} !^123\.456\.789\.000 | |
RewriteCond %{DOCUMENT_ROOT}/maintenance.html -f | |
RewriteCond %{DOCUMENT_ROOT}/maintenance.enable -f | |
RewriteCond %{SCRIPT_FILENAME} !maintenance.html | |
RewriteRule ^.*$ /maintenance.html [R=503,L] | |
ErrorDocument 503 /maintenance.html | |
Header Set Cache-Control "max-age=0, no-store" | |
</IfModule> | |
</VirtualHost> | |
This file contains hidden or 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
blank file. | |
If it exist in public directory of the project, then you will be in maintenance mode else it will be in working mode. |
This file contains hidden or 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
simple HTML content to display maintenance msg. |
This file contains hidden or 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
apachectl graceful | |
From now we can TURN ON and TURN OFF the maintenance mode, with maintenance.enable file, without Apache restart/reload. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment