nginx配置nginx.conf

静态图片映射

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;
    }
  }

注意错误日志信息logs/error.log

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值