nginx支持4层代理,可以代理常规tcp/udp端口。
stream { log_format proxy '$remote_addr [$time_local]' '$protocol $status $bytes_sent $bytes_received' '$session_time "$upstream_addr" ' '"$upstream_bytes_sent" "$upstream_bytes_received" "$upstream_connect_time"'; access_log //app/nginx-1.16.1/logs/tcp-access.log proxy ; error_log /app/nginx-1.16.1/logs/tcp-error.log warn ; upstream sms_proxy { hash $remote_addr consistent; server 10.198.40.102:9539; } server { listen 9539; proxy_connect_timeout 1s; proxy_timeout 10s; proxy_pass sms_proxy; } }