Skip to content

Instantly share code, notes, and snippets.

@koheyamada
Created October 18, 2018 12:28
Show Gist options
  • Save koheyamada/fd439a78db9477606f7f2a2ccc1c156e to your computer and use it in GitHub Desktop.
Save koheyamada/fd439a78db9477606f7f2a2ccc1c156e to your computer and use it in GitHub Desktop.
nginxでメンテナンスページを表示させる。 ref: https://qiita.com/kooohei/items/b0deaf39124e7a47546a
set $maintenance "true";
if ($uri ~ "^/maintenance.html") {
set $maintenance "false";
}
if ($uri ~ "^/exclude/") {
set $maintenance "false";
}
if ($remote_addr ~ "xxx.xxx.xxx.xxx") {
set $maintenance "false";
}
if ($maintenance = "true") {
rewrite ^(.*)$ http://www.hoge.jp/maintenance.html? redirect;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment