1204

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

你可能感興趣的文章

臺中市雲端校務系統與Windows AD帳號整合(7) 設定校端更改密碼程式及執行

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

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

windows 使用 command 移除程式 使用 command 移除程式

[shell script] 批次判斷domain name 正解設定 判斷dns 正解設定

windows ad 如何得知 dn 值 如何得知 windows ad 上的使用者dn 值 https://support.symantec.com/en_US

隨機好文

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

雲端校務系統與OPENLDAP帳號整合(2) openldap,雲端校務

google sheet 限制使用者以點選的方式填答 google sheet 限制使用者以點選的方式填答

javascript 陣列 javascript 陣列可以放各种型別的元素 let data = [1,2,"john",tru

台中市校園空氣品質預警 aqi

精讚::