程序员开发实例大全宝库

网站首页 > 编程文章 正文

Arcgis-JS离线部署(arcgispro离线授权文件)

zazugpt 2024-10-17 18:14:20 编程文章 16 ℃ 0 评论

使用nginx配置arcgis的JS种子包

迁移arcgis的JS包放置在nginx的目录底下

在nginx.conf的配置下添加配置说明

server {
 listen 8099;
 server_name localhost;
 location /library/4.8/init.js {
 sub_filter 'https://[HOSTNAME_AND_PATH_TO_JSAPI]' 'http://$host:$server_port//library/4.8/';
 sub_filter_once off;
 sub_filter_types application/javascript;
 root arcgisJs; 
 }
 location ~* \.(eot|otf|ttf|woff|woff2)$ {
 add_header Access-Control-Allow-Origin *;
 add_header Access-Control-Allow-Headers X-Requested-With;
 add_header Access-Control-Allow-Methods GET,POST,OPTIONS;
 root arcgisJs;
 }
 location / {
 root arcgisJs;
 index index.html index.htm;
 }
}

配置注意项

  • 需添加上 sub_filter_types配置上application/javascript 不然会出现过滤失败。
  • 需添加上 sub_filter_once off。off表示的全部替换,on是默认表示替换一次。
  • 需添加上 字体的内容信息,不然字体加载不出来。

解决字体的问题

找到nginx的mime配置文件,

添加以下代码:

application/x-font-ttf ttf;
font/opentype otf;
application/vnd.ms-fontobject eot;
font/x-woff

本文暂时没有评论,来添加一个吧(●'◡'●)

欢迎 发表评论:

最近发表
标签列表