Linux操作记录2--Nginx代理端口

Nginx 安装

参照这个链接就好了
http://nginx.org/en/linux_packages.html#RHEL
使用nginx -V, 看到如下界面,就OK了

Nginx配置

在/etc/nginx/nginx.conf最下面加入如下代码

1
2
3
4
5
6
7
8
9
10
11
stream {
upstream ssh{
server 1.2.3.4:22;
}
server {
listen 8022;
proxy_connect_timeout 1h;
proxy_timeout 1h;
proxy_pass ssh;
}
}

重载配置

1
systemctl reload nginx

然后就可以用8022端口去连接服务器啦