[精讚] [會員登入]
664

如何在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

你可能感興趣的文章

[web] 自訂模組-打字機與跑馬燈效果 自訂模組-打字機效果

臺中市雲端校務系統與Windows AD帳號整合(3) LDAP的基本概念

資料表更改為多個primary key, MariaDB [database]> describe TABLENAME; 想由本來是兩個PRIMARY KE

openldap資料移到 docker 拉docker 上的 image 回來 docker pull osixia/openldap 在正在運行的openld

shell scirpt 批次建立samba使用者 建立一csv檔, 兩個欄位如下 5101,532 5102,592 5103,321 第一欄為帳號使用班級加座號, 第二

臺中市校務雲端系統與Windows AD帳號整合(1) active directory,ldaps,雲端校務系統

我有話要說

>>

限制:留言最高字數1000字。 限制:未登入訪客,每則留言間隔需超過10分鐘,每日最多5則留言。

訪客留言

[無留言]

隨機好文

centos 7 移机出現 dracut-initqueue timeout centos 7 移机出現 dracut-initqueue timeout 處理

資料表更改為多個primary key, MariaDB [database]> describe TABLENAME; 想由本來是兩個PRIMARY KE

apache 反向代理 80轉443轉8080 apache, proxy pass

ArrayList 與 HashMap 範例 public static void main(String[] args) { String titleIds = &

對照mac address 批次更改電腦名稱 讀取mac address 對照表, 還原電腦後,自動更改密碼 'show logged on user Dim