—— 阿尔伯特·爱因斯坦

程序员の奇妙冒险

NginxNginx
2025-08-08 09:31阅读:35评论:0

nginx TCP转发

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
http {
// ....
}
 
stream {
log_format simple '$remote_addr [$time_local] $protocol $status';
# 包含动态生成的中国 IP 列表
include /usr/local/nginx/china_ips_dynamic.conf;
 
deny all;
 
upstream iot_data_service {
server 127.0.0.1:8080;
}
 
server {
listen 8081;
proxy_pass iot_data_service;
 
proxy_timeout 24h; # 24小时超时
proxy_responses 0; # 保持连接直到客户端断开
 
tcp_nodelay on;
 
proxy_next_upstream on;
access_log /home/.nginx/logs/tcp_access.log simple;
}
}
 
评论(0)
暂无评论来抢沙发吧~