一、需求
当前置机需要转发内网主机的ssh端口号,方便外网直连服务器。
二、nginx配置
注:与events, http同级,配置stream即可
events {
worker_connections 1024;
accept_mutex on;
}
stream {
upstream ssh {
server IP:22;
}
server {
listen 9028;
proxy_pass ssh;
proxy_connect_timeout 1h;
proxy_timeout 1h;
}
}