nginx4层代理ssh服务

 四层代理依赖模块ngx_stream_core_module,默认情况下,此模块不构建,应使用配置参数启用 --with-stream

 配置文件内容:

...

stream {
    upstream ssh_proxy {
        hash $remote_addr consistent; #远程地址做个hash
        server 192.168.129:22;
    }
    server {
        listen 2222;
        proxy_connect_timeout 180s; #后端链接空闲超时断开
        #proxy_timeout 90s; #后端连接超时时间
        proxy_pass ssh_proxy;
    }
}

原文地址:https://www.cnblogs.com/goujinyang/p/15562601.html