[精讚] [會員登入]
1049

如何在docker 的nginx 做另一個container的反向代理

環境 docker 中一container 跑 nginx 對外服務80 port, http://server 另一c

分享此文連結 //n.sfs.tw/15540

分享連結 如何在docker 的nginx 做另一個container的反向代理@igogo
(文章歡迎轉載,務必尊重版權註明連結來源)
2021-12-18 22:06:26 最後編修
2021-12-18 22:02:33 By igogo
 

 

環境

 

docker 中一container 跑 nginx   對外服務80 port, http://server

另一container 名為another_web跑 web服務於19090 port , 需要提供對外服務於http://server/user

 

 

設定於nginx container的nginx.conf中

  http {
      server {
            listen 80;

            location /api {
                proxy_pass http://another_web:19090;
                proxy_redirect     off;
                proxy_set_header   Host $host;
                proxy_set_header   X-Real-IP $remote_addr;
                proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header   X-Forwarded-Host $server_name;
            }
      }
    }

 

 

參考

https://stackoverflow.com/questions/39514293/docker-nginx-proxy-how-to-route-traffic-to-different-container-using-path-and-n

END

你可能感興趣的文章

使用vbs設定windows 10 靜態IP setting static ip Set Adapter = GetObject("winmgmts:Win

如何檢查網站憑證是否過期 檢查網站憑證

利用expect script 查詢ap數量,再送到google sheet及line群組通知 利用expect script 查詢ap數量

mongo備份指令 mongodump --host localhost --port 27017 --username root --db

臺中市雲端校務系統與Windows AD帳號整合(9) 3-2 Linux上隨系統開機啟動服務 以Centos 7 發行版為例 請注意, 此時提供服務的主机為Linux, 所以

網站無障礙規範 https://accessibility.ncc.gov.tw/News/Detail/3238?Category=4

隨機好文

編碼的順序 utf8 big5

讀取特定資料夾下的xls檔 讀取特定資料夾下的xls檔

[scratch2] 分數排名 在清單中隨机產生5名學生的考試分數, 再利用另一個清單排名 想法, 分數愈高者排名愈好, 例如名次是第5名, 那分數是最

在docker裡跑spring boot+mongo(二) 使用docker-compose 管理多個container 前篇使用docker run 一次建一個container

刪除資料夾內的檔案 lambda 一行文 Arrays.stream(new File("/folder/path").