首页 > 其他 > 详细

nginx通过stream模块实现反向代理

时间:2020-11-18 14:48:53      阅读:158      评论:0      收藏:0      [点我收藏+]

默认安装的nginx是没有开启stream模块的,需要在安装时添加,如果已经安装了,后续安装的话,请看这篇文章NGINX的后续模块添加

在nginx的解压包里执行,已添加了stream模块

./configure --prefix=/usr/local/nginx \
--with-http_stub_status_module \
--with-http_ssl_module \
--with-http_realip_module\
--with-http_flv_module \
--with-http_mp4_module \
--with-http_gzip_static_module \
--with-stream \
--with-stream_ssl_module && make j4 && make install

然后修改配置文件

vi /usr/local/nginx/conf/nginx.conf
#已省略无关部分
events {
    worker_connections  1024;
}
#如有需要可添加多个server
stream{
     server{
       listen 12345 so_keepalive=on; #监听本机12345端口
       proxy_pass 172.14.15.16:12345; #转发到该ip的12345端口
       }
}

http {
    include       mime.types;
    default_type  application/octet-stream;

 

nginx通过stream模块实现反向代理

原文:https://www.cnblogs.com/yuan9910/p/13999057.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!