佳木斯湛栽影视文化发展公司

主頁 > 知識庫 > Nginx 根據(jù)URL帶的參數(shù)轉發(fā)的實現(xiàn)

Nginx 根據(jù)URL帶的參數(shù)轉發(fā)的實現(xiàn)

熱門標簽:網(wǎng)站建設 阿里云 智能手機 檢查注冊表項 硅谷的囚徒呼叫中心 百度競價點擊價格的計算公式 美圖手機 使用U盤裝系統(tǒng)

使用場景:

需要根據(jù)截取URL動態(tài)配置跳轉路徑,常見于訪問內網(wǎng)不固定ip地址的文件圖片,

請求地址:http://11.19.1.212:82/bimg4/32.52.62.42:222/DownLoadFile?filename=LOC:12/data/20180208/15/2e0ae54dfd752210083404deed15269c_222403

實際需要訪問的內網(wǎng)地址:http://32.52.62.42:222/DownLoadFile?filename=LOC:12/data/20180208/15/2e0ae54dfd752210083404deed15269c_222403

nginx配置文件

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之后的路徑,并賦給轉發(fā)地址
  location ^ ~ / bimg4 / {
    if ($request_uri~ / bimg4 / (. * )) {
      set $bucketid $1;
    }
    proxy_pass http: //$bucketid;
  }
}

到此這篇關于Nginx 根據(jù)URL帶的參數(shù)轉發(fā)的實現(xiàn)的文章就介紹到這了,更多相關Nginx URL帶參數(shù)轉發(fā)內容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持腳本之家!

標簽:湘潭 賀州 煙臺 山南 湖北 黃山 通遼 懷化

巨人網(wǎng)絡通訊聲明:本文標題《Nginx 根據(jù)URL帶的參數(shù)轉發(fā)的實現(xiàn)》,本文關鍵詞  ;如發(fā)現(xiàn)本文內容存在版權問題,煩請?zhí)峁┫嚓P信息告之我們,我們將及時溝通與處理。本站內容系統(tǒng)采集于網(wǎng)絡,涉及言論、版權與本站無關。
  • 相關文章
  • 收縮
    • 微信客服
    • 微信二維碼
    • 電話咨詢

    • 400-1100-266
    瓦房店市| 巩义市| 西平县| 米泉市| 土默特右旗| 筠连县| 潜江市| 滦南县| 麟游县| 汕尾市| 永嘉县| 延庆县| 冷水江市| 青浦区| 白沙| 新安县| 根河市| 眉山市| 中卫市| 秦皇岛市| 绥化市| 平阳县| 泰和县| 筠连县| 鹤庆县| 尉犁县| 张家口市| 长沙县| 中江县| 江华| 宾阳县| 镇平县| 项城市| 辽中县| 娄烦县| 商洛市| 平和县| 黄梅县| 个旧市| 泽库县| 商丘市|