笔记一下:配置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 /{
...
本文详细介绍了如何在Nginx中设置规则,使得无论输入任何地址,请求都将被重定向到指定的维护页面。
3655

被折叠的 条评论
为什么被折叠?



