duzhor
V2EX  ›  问与答

请教 nginx 配置 tcp 转发的问题

  •  
  •   duzhor · Nov 27, 2021 · 1707 views
    This topic created in 1705 days ago, the information mentioned may be changed or developed.

    我配置好了多个 stream 反代不同端口,为了这样实现 nginx 也分别绑定了对应的端口。

    能不能 nginx 只绑 80 端口,根据请求的域名不同分流到不同的端口去?

    请求 a.domain1.com:80 > domain2.com:8081

    请求 b.domain1.com:80 > domain2.com:8082

    1 replies    2021-11-27 19:04:29 +08:00
    a8Fy37XzWf70G0yW
        1
    a8Fy37XzWf70G0yW  
       Nov 27, 2021 via Android
    只要後面是 http 或者支持 SNI 的 https 就可以這樣做。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3185 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 11:25 · PVG 19:25 · LAX 04:25 · JFK 07:25
    ♥ Do have faith in what you're doing.