# ============================================================================ # 子域名 Stream 分流配置 # 文件:zhonjin_stream.conf # 用途:mqtt.zhonjin.com / baolin.zhonjin.com 的 TCP 层协议检测 + 自动分流 # 挂载方式:在 nginx.conf 的 stream 块中 include 本文件 # 路径:/etc/nginx/stream.d/zhonjin_stream.conf # ============================================================================ # ======================================================================== # Stream 服务组 2:外网端口 40715 → 内网 8085(mqtt.zhonjin.com) # ======================================================================== map $ssl_preread_protocol $backend_target_40715 { "" 127.0.0.1:5008; # 明文HTTP → 301跳转到HTTPS default 127.0.0.1:5007; # TLS流量 → SSL解密入口 } server { listen 40715 backlog=4096; tcp_nodelay on; ssl_preread on; proxy_pass $backend_target_40715; proxy_connect_timeout 10s; proxy_timeout 3600s; proxy_next_upstream off; access_log /var/log/nginx/stream_access_40715.log stream_main; } # ======================================================================== # Stream 服务组 3:外网端口 40716 → 内网 5000(baolin.zhonjin.com) # ======================================================================== map $ssl_preread_protocol $backend_target_40716 { "" 127.0.0.1:5010; # 明文HTTP → 301跳转到HTTPS default 127.0.0.1:5009; # TLS流量 → SSL解密入口 } server { listen 40716 backlog=4096; tcp_nodelay on; ssl_preread on; proxy_pass $backend_target_40716; proxy_connect_timeout 10s; proxy_timeout 3600s; proxy_next_upstream off; access_log /var/log/nginx/stream_access_40716.log stream_main; } # ======================================================================== # Stream 服务组 4:外网端口 40719 → 内网 5001(baolin.zhonjin.com) # ======================================================================== map $ssl_preread_protocol $backend_target_40719 { "" 127.0.0.1:5012; # 明文HTTP → 301跳转到HTTPS default 127.0.0.1:5011; # TLS流量 → SSL解密入口 } server { listen 40719 backlog=4096; tcp_nodelay on; ssl_preread on; proxy_pass $backend_target_40719; proxy_connect_timeout 10s; proxy_timeout 3600s; proxy_next_upstream off; access_log /var/log/nginx/stream_access_40719.log stream_main; }