location / {
return 502 "服务正在升级,请稍后再试……";
}
直接返回文本:
location / {
default_type text/plain;
return 502 "服务正在升级,请稍后再试……";
}
也可以使用html标签格式:
location / {
default_type text/html;
return 502 "服务正在升级,请稍后再试……";
}
也可以直接返回json文本:
location / {
default_type application/json;
return 502 '{"status":502,"msg":"服务正在升级,请稍后再试……"}';
}
返回json
location ~ ^/get_json {
default_type application/json;
return 200 '{"status":"success","result":"nginx json"}';
}
根据请求的URL返回不同的字符串
location ~ ^/get_text/article/(.*)_(\d+).html$ {
default_type text/html;
set $s $1;
set $d $2;
return 200 str:$s$d;
}
location / {
set $upstream_name "10.x.x.x:8711";
more_set_headers 'Content-Type: text/html; charset=utf-8';
return 200 "系统已经迁移至 xz.test.com,相关问题请咨询xxx";
proxy_pass http://$upstream_name;
}
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。