笔记一下:配置nginx输入任何地址都跳转至维护页面

笔记一下:配置nginx输入任何地址都跳转至维护页面


server {
    listen 80;
    root /xxx/xxx/src;
    index index.html index.htm;

    server_name test.xxx.com;

    set $flag 0;
      if ($request_uri !~ "(/static/.*)$"){
          set $flag "${flag}1";
      }
      if ($request_uri !~ "/502.html$" ){
          set $flag "${flag}2";
      }
      if ($flag = "012") {
         rewrite ^(.*) http://test.xxx.com/502.html permanent;
      }

 location /{
     ...

你可能感兴趣的:(linux运维)