配置如下
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;
}
访问返回
系统已经迁移至 xz.test.com,相关问题请咨询xxx
如果报错:
nginx: [emerg] unknown directive "more_set_headers" in xxx.conf
可以使用下面的方式
在server段里加以下两行
default_type 'text/html';
charset utf-8;
然后重启就行了
sudo nginx -s reload
转载于:https://blog.51cto.com/tenderrain/2047597