Skip to content

Instantly share code, notes, and snippets.

@eru
Created February 5, 2016 01:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eru/ca8b7b999f743c22913e to your computer and use it in GitHub Desktop.
Save eru/ca8b7b999f743c22913e to your computer and use it in GitHub Desktop.
##
## メンテナンスモード用コンフィグ
##
## How to use:
## maintenance mode on
## $ rename .conf .conf.maintenance *.conf && rename .conf.tmp .conf *.conf.tmp && service httpd restart
## maintenance mode off
## $ rename .conf .conf.tmp *.conf && rename .conf.maintenance .conf *.conf.maintenance && service httpd restart
##
## Tips:
## VirtualHostの最初の項目が、デフォルト設定をして使われることを利用して、他のconfigファイルを読み込まれない状態にした上で、
## このconfigファイルを有効にすることで、503のメンテナンス表示を行う。
## また、デフォルト表示のため、ServerNameに指定するドメイン名はなんでもよい。
NameVirtualHost *:80
<VirtualHost *:80>
ServerName example.com
DocumentRoot "/etc/httpd/conf.d"
<Directory "/etc/httpd/conf.d">
allow from all
Options -Indexes
AddHandler cgi-script htaccess
ErrorDocument 503 /maintenance.html
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} !=/maintenance.html
RewriteRule ^.*$ - [R=503,L]
</IfModule>
</Directory>
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment