zhonjin_stream.conf 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. # ============================================================================
  2. # 子域名 Stream 分流配置
  3. # 文件:zhonjin_stream.conf
  4. # 用途:mqtt.zhonjin.com / baolin.zhonjin.com 的 TCP 层协议检测 + 自动分流
  5. # 挂载方式:在 nginx.conf 的 stream 块中 include 本文件
  6. # 路径:/etc/nginx/stream.d/zhonjin_stream.conf
  7. # ============================================================================
  8. # ========================================================================
  9. # Stream 服务组 2:外网端口 40715 → 内网 8085(mqtt.zhonjin.com)
  10. # ========================================================================
  11. map $ssl_preread_protocol $backend_target_40715 {
  12. "" 127.0.0.1:5008; # 明文HTTP → 301跳转到HTTPS
  13. default 127.0.0.1:5007; # TLS流量 → SSL解密入口
  14. }
  15. server {
  16. listen 40715 backlog=4096;
  17. tcp_nodelay on;
  18. ssl_preread on;
  19. proxy_pass $backend_target_40715;
  20. proxy_connect_timeout 10s;
  21. proxy_timeout 3600s;
  22. proxy_next_upstream off;
  23. access_log /var/log/nginx/stream_access_40715.log stream_main;
  24. }
  25. # ========================================================================
  26. # Stream 服务组 3:外网端口 40716 → 内网 5000(baolin.zhonjin.com)
  27. # ========================================================================
  28. map $ssl_preread_protocol $backend_target_40716 {
  29. "" 127.0.0.1:5010; # 明文HTTP → 301跳转到HTTPS
  30. default 127.0.0.1:5009; # TLS流量 → SSL解密入口
  31. }
  32. server {
  33. listen 40716 backlog=4096;
  34. tcp_nodelay on;
  35. ssl_preread on;
  36. proxy_pass $backend_target_40716;
  37. proxy_connect_timeout 10s;
  38. proxy_timeout 3600s;
  39. proxy_next_upstream off;
  40. access_log /var/log/nginx/stream_access_40716.log stream_main;
  41. }
  42. # ========================================================================
  43. # Stream 服务组 4:外网端口 40719 → 内网 5001(baolin.zhonjin.com)
  44. # ========================================================================
  45. map $ssl_preread_protocol $backend_target_40719 {
  46. "" 127.0.0.1:5012; # 明文HTTP → 301跳转到HTTPS
  47. default 127.0.0.1:5011; # TLS流量 → SSL解密入口
  48. }
  49. server {
  50. listen 40719 backlog=4096;
  51. tcp_nodelay on;
  52. ssl_preread on;
  53. proxy_pass $backend_target_40719;
  54. proxy_connect_timeout 10s;
  55. proxy_timeout 3600s;
  56. proxy_next_upstream off;
  57. access_log /var/log/nginx/stream_access_40719.log stream_main;
  58. }