A为外网服务器
B为内网服务器
nginx配置
server {
listen 8081;
server_name 15.72.185.21;
location /webapi/ {
proxy_pass http://15.72.191.145:18090/;
}
location /restapi {
proxy_pass http://15.72.191.145:18090/restapi/;
}
location /maps {
proxy_set_header Accept-Encoding "";
proxy_pass http://15.72.191.145:18090/maps/;
sub_filter_types *;
sub_filter_once off;
sub_filter 'http://webapi.amap.com' 'http://15.72.191.145:18090/webapi';
sub_filter 'https://webapi.amap.com' 'http://15.72.191.145:18090/';
sub_filter 'http://restapi.amap.com' 'http://15.72.191.145:18090/restapi';
sub_filter 'http://vdata.amap.com' 'http://15.72.191.145:18090/vdata';
sub_filter 'vdata.amap.com' '15.72.191.145:18090/vdata';
sub_filter 'vdata0{1,2,3,4}.amap.com' '15.72.191.145:18090/vdata0{1,2,3,4}';
sub_filter '{vdata,vdata01,vdata02,vdata03,vdata04}.amap.com' '15.72.191.145:18090/{vdata,vdata01,vdata02,vdata03,vdata04}';
sub_filter 'webapi.amap.com/count' '15.72.191.145:18090/count';
sub_filter 'wprd0{1,2,3,4}.is.autonavi.com' '15.72.191.145:18090/wprd0{1,2,3,4}';
sub_filter 'webapi.amap.com/theme' '15.72.191.145:18090/theme';
sub_filter 'restapi.amap.com/v4' '15.72.191.145:18090/restapi/v4';
sub_filter 'webapi.amap.com/style' '15.72.191.145:18090/style';
sub_filter 'https' 'http';
}
location /vdata {
proxy_pass http://15.72.191.145:18090/vdata/;
}
location /vdata01 {
proxy_pass http://15.72.191.145:18090/vdata01/;
}
location /vdata02 {
proxy_pass http://15.72.191.145:18090/vdata02/;
}
location /vdata03 {
proxy_pass http://15.72.191.145:18090/vdata03/;
}
location /vdata04 {
proxy_pass http://15.72.191.145:18090/vdata04/;
}
}
标签:http,sub,191.145,18090,filter,nginx,内网,高德,15.72 From: https://www.cnblogs.com/yuan9910/p/18119485webapi注意 / ,可能是我对nginx的location匹配规则还不熟悉,大坑,目前这么配置是能成功访问高德的