duzhor
V2EX  ›  问与答

请教 nginx 配置 tcp 转发的问题

  •  
  •   duzhor · Nov 27, 2021 · 1712 views
    This topic created in 1708 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   ·   2411 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 00:37 · PVG 08:37 · LAX 17:37 · JFK 20:37
    ♥ Do have faith in what you're doing.