本背景是实现服务器代理登录
安装依赖 yum install gcc gcc-c++ zlib-devel pcre-devel openssl openssl-devel -y
重新编译nginx
./configure --prefix=/home/deploy/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module --with-file-aio --with-stream
在http{}之外配置以下文件
stream {
upstream tcp_proxy {
hash $remote_addr consistent; #远程地址做个hash
server IP地址:22;
}
server {
listen 2234;
proxy_connect_timeout 1s;
#proxy_timeout 10s; #后端连接超时时间
proxy_pass tcp_proxy;
}
}
最后在xshell上实现远程:ssh://centos@IP地址:2235