静态图片映射
location /image/ {
root /;
rewrite ^/image/(.*)$ /home/sddata/$1 break;
}
server {
listen 9091;
server_name localhost;
root /home/sddata/;
location / {
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Methods GET,POST,PUT,DELETE,OPTIONS;
}
}
http://IP/image/fy2e.png/IR1/20180131/0300.png
/home/sddata/fy2e.png/IR1/20180131/0300.png
nginx转发
192.168.10.17:9200转发到10.226.123.107:9200
server {
listen 9200;
server_name 10.226.123.107;
location / {
proxy_pass http://192.168.10.17:9200;
}
}
http://map.geoq.cn/ArcGIS/rest/services/ChinaOnlineCommunity/MapServer/tile/{z}/{y}/{x}
转发为
http://localhost/dzt/ArcGIS/rest/services/ChinaOnlineCommunity/MapServer/tile/{z}/{y}/{x}
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
location /dzt/ {
proxy_pass http://map.geoq.cn/;
}
location /xzt/ {
proxy_pass http://thematic.geoq.cn/;
}
}
nginx发布/home/data/draw/为http://localhost:9094/file
server {
listen 0.0.0.0:9094;
location /file {
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS';
add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
if ($request_method = 'OPTIONS') {
return 204;
}
index index.html index.htm;
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
alias /home/data/draw/;
}
}
server {
listen 80;
server_name localhost;
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Headers X-Requested-With;
add_header Access-Control-Allow-Methods GET,POST,OPTIONS;
add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization,x-oss-user-agent,x-oss-date';
location / {
root /home/web;
index index.html;
}
location /server {
include uwsgi_params;
rewrite ^/server/(.*) /$1 break;
proxy_pass http://localhost:8099;
}
}