使用场景:

需要根据截取URL动态配置跳转路径,常见于访问内网不固定ip地址的文件图片,

请求地址:http://11.19.1.212:82/bimg4/32.52.62.42:222/DownLoadFile"htmlcode">

server {
  listen 83;
  server_name localhost;
  index index.html index.htm;

  root D: /workspace-xxxx/xxx_Web;

  error_page 500 502 503 504 / 50x.html;
  location = /50x.html {
      root  html;
    }
  location ^~ /xxx/ {
    proxy_pass http: //192.168.60.36:8090/xxxx/;
    proxy_redirect default;
    proxy_set_header Host $host;
    proxy_set_header X - Real - IP $remote_addr;
    proxy_set_header X - Forwarded - Host $host;
    proxy_set_header X - Forwarded - Server $host;
    proxy_set_header X - Forwarded - For $proxy_add_x_forwarded_for;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "Upgrade";
  }
# 此处为截取请求地址中bimg4之后的路径,并赋给转发地址
  location ^ ~ / bimg4 / {
    if ($request_uri~ / bimg4 / (. * )) {
      set $bucketid $1;
    }
    proxy_pass http: //$bucketid;
  }
}
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!