nginx维护页面-所有URL指向同一个页面

nginx维护页面处理-所有URL指向同一个页面
html

通常来讲nginx的维护页面须要把全部访问本站的连接所有重定向到某个指定页面nginx

方法一 rewriteweb

rewrite ^(.*)$ /maintain.html break;ide

注意这句后面若是有重定向等语句,那么后面执行的重定向等语句须要所有注释掉spa



方法二 使用状态码orm

location /{server

  return 503;htm

}utf-8

注意其余location优先级高的匹配均须要注释掉it

error_page  503              /maintain.html;


方法三 

server {

        listen       4008;

        server_name  localhost;


        charset utf-8;


        #access_log  logs/host.access.log  main;


        location / {

            root   /var/webroot/maintain/;

            index  index.html index.htm;

        }



        # redirect server error pages to the static page /50x.html

        #

        error_page   404 405 500 502 503 504  /index.html;

        location = /index.html {

            root   /var/webroot/maintain/;

        }


}

相关文章
相关标签/搜索