日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

可视化优化:百度地图内网访问(通过nginx代理)

發布時間:2023/12/16 编程问答 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 可视化优化:百度地图内网访问(通过nginx代理) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

1、首先下載你所使用版本的百度地圖api文件

我用的是最新的(https://api.map.baidu.com/getscript)下載到本地。

2、找到其中所有的url地址,我找到的如下:

gss0.bdstatic.commaponline0.bdimg.com maponline1.bdimg.com maponline2.bdimg.com maponline3.bdimg.com gsp0.baidu.comapi.map.baidu.comshangetu0.map.bdimg.com shangetu1.map.bdimg.com shangetu2.map.bdimg.com shangetu3.map.bdimg.com shangetu4.map.bdimg.comd0.map.baidu.com d1.map.baidu.com d2.map.baidu.com d3.map.baidu.comloc.map.baidu.comg0.api.map.baidu.com g1.api.map.baidu.com g2.api.map.baidu.com g3.api.map.baidu.comits.map.baidu.com:8002pcsv0.map.bdimg.com pcsv1.map.bdimg.com pcsv2.map.bdimg.comj.map.baidu.commap.baidu.com wuxian.baidu.com(ping 不通)api0.map.bdimg.com api1.map.bdimg.com api2.map.bdimg.comwebmap0.map.bdimg.commapclick.map.baidu.com(ping 不通)or.map.bdimg.comwww.w3.orglbsyun.baidu.com

3、在剛剛下載的文件里面,把上面的所有地址的前面加上如下格式:

內網ip地址:端口號/? ? (eg:10.1.3.120:8030/maponline0.bdimg.com)

4、改完之后保存文件為? mapApi.min.js

5、將該文件放到項目下,并且通過script標簽引用

<script type="text/javascript" src="${request.contextPath}/static/common/baidu-map/mapApi.min.js"></script>

6、接下來配置nginx服務器,把上面ping通的網址在nginx服務器中配置,ping不通的就不要配置了,否則會報錯

## 百度地圖資源映射關系server {listen 8030;server_name localhost;##此為api入口,需設置ak參數location /api.map.baidu.com/ {set $args "ak=ndTT3OvHXm8CftOj0EhVDGnaSmXom7Fw";proxy_pass http://api.map.baidu.com/;}location /its.map.baidu.com/ {proxy_pass http://its.map.baidu.com/;} location /gss0.bdstatic.com/ {proxy_pass http://gss0.bdstatic.com/;} location /maponline0.bdimg.com/ {proxy_pass http://maponline0.bdimg.com/;}location /maponline1.bdimg.com/ {proxy_pass http://maponline1.bdimg.com/;}location /maponline2.bdimg.com/ {proxy_pass http://maponline2.bdimg.com/;}location /maponline3.bdimg.com/ {proxy_pass http://maponline3.bdimg.com/;}location /gsp0.baidu.com/ {proxy_pass http://gsp0.baidu.com/;}location /shangetu0.map.bdimg.com/ {proxy_pass http://shangetu0.map.bdimg.com/;}location /shangetu1.map.bdimg.com/ {proxy_pass http://shangetu1.map.bdimg.com/;}location /shangetu2.map.bdimg.com/ {proxy_pass http://shangetu2.map.bdimg.com/;}location /shangetu3.map.bdimg.com/ {proxy_pass http://shangetu3.map.bdimg.com/;}location /shangetu4.map.bdimg.com/ {proxy_pass http://shangetu4.map.bdimg.com/;}location /d0.map.baidu.com/ {proxy_pass http://d0.map.baidu.com/;}location /d1.map.baidu.com/ {proxy_pass http://d1.map.baidu.com/;}location /d2.map.baidu.com/ {proxy_pass http://d2.map.baidu.com/;}location /d3.map.baidu.com/ {proxy_pass http://d3.map.baidu.com/;}location /loc.map.baidu.com/ {proxy_pass http://loc.map.baidu.com.com/;}location /g0.api.map.baidu.com/ {proxy_pass http://g0.api.map.baidu.com/;}location /g1.api.map.baidu.com/ {proxy_pass http://g1.api.map.baidu.com/;}location /g2.api.map.baidu.com/ {proxy_pass http://g2.api.map.baidu.com/;}location /g3.api.map.baidu.com/ {proxy_pass http://g3.api.map.baidu.com/;}location /pcsv0.map.bdimg.com/ {proxy_pass http://pcsv0.map.bdimg.com/;}location /pcsv1.map.bdimg.com/ {proxy_pass http://pcsv1.map.bdimg.com/;}location /pcsv2.map.bdimg.com/ {proxy_pass http://pcsv2.map.bdimg.com/;}location /j.map.baidu.com/ {proxy_pass http://j.map.baidu.com/;}location /map.baidu.com/ {proxy_pass http://map.baidu.com/;}location /api0.map.bdimg.com/ {proxy_pass http://api0.map.bdimg.com/; } location /api1.map.bdimg.com/ {proxy_pass http://api1.map.bdimg.com/; } location /api2.map.bdimg.com/ {proxy_pass http://api2.map.bdimg.com/; } location /webmap0.map.bdimg.com/ {proxy_pass http://webmap0.map.bdimg.com/; }location /or.map.bdimg.com/ {proxy_pass http://or.map.bdimg.com/;}location /www.w3.org/ {proxy_pass http://www.w3.org/;}location /lbsyun.baidu.com/ {proxy_pass http://lbsyun.baidu.com/;}location /static.tieba.baidu.com/ {proxy_pass http://static.tieba.baidu.com/;}}

7、在設置nginx時如果不設置ak,內網訪問時會報百度地圖api未授權,所以必須在nginx里面配置

##此為api入口,需設置ak參數location /api.map.baidu.com/ {set $args "ak=ndTT3OvHXm8CftOj0EhVDGnaSmXom7Fw";proxy_pass http://api.map.baidu.com/;}

現在你就可以通過內網訪問你的百度地圖了

總結

以上是生活随笔為你收集整理的可视化优化:百度地图内网访问(通过nginx代理)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。