end0tknr's kipple - web写経開発

太宰府天満宮の狛犬って、妙にカワイイ

nginx で、メンテナンス画面を表示する conf.d/test.end0tknr.com.conf

以下の通り

sserver {
  listen 8080;
  server_name test.end0tknr.com;
  
  limit_req zone=one burst=50;
  server_tokens off;
  
  error_page 503 @maintenance;
  set $maintenance "on";

  if ($uri ~ "^/(css|images|js)/") {
     set $maintenance "off";
  }
  if ($uri ~ "^/(header.html|footer.html)") {
     set $maintenance "off";
  }

  if ($maintenance = "on") {
    return 503;
  }
  
  location / {
    try_files $uri $uri/ =404;
  }
  location @maintenance {
     rewrite ^(.*)$ /maintenance.html break;
  }
}