利用nginx的stream模块实现内网端口的转发代理

一、安装nginx使其支持stream

#直接使用yum(epel源)安装,如果使用源码安装编译时加上 --with-stream
[root@localhost ~]# yum -y install nginx

二、配置nginx配置文件

[root@localhost ~]# vim /etc/nginx/nginx.conf
stream {
        server {
                listen 8000;  #将8000端口,转到113的80
                proxy_connect_timeout 10s;
                proxy_timeout 5s;
                proxy_pass 192.168.200.113:80;
        }
}
在http段前加上

三、测试

可以安装apache通过网页访问测试或者通过xshell连接访问