Nginx can not only implement http reverse proxy, but also supports TCP reverse proxy
The prerequisite
needs to add the parameter –with-stream when compiling to load the ngx_stream_core_module module
Note that vim nginx.conf should be added to http, not http.
Examples:
stream {
upstream tcp_proxy{
hash $remote_addr consistent;
server 192.168.56.12:10960
}
server {
listen 18098 so_keepalive=on;
proxy_connect_timeout 1s;
proxy_timeout 3s;
proxy_pass tcp_proxy;
}
}