zoukankan      html  css  js  c++  java
  • nginx通过stream模块实现*

    nginx从1.9.0开始,新增加了一个stream模块,用来实现四层协议的转发、代理或者负载均衡等

    默认安装的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;
  • 相关阅读:
    【bzoj2006】超级钢琴
    【bzoj4940】这是我自己的发明
    【arc076E】Connected?
    【agc004C】AND Grid
    选举
    几何
    打击目标
    【CF Gym100228】Graph of Inversions
    【CodeChef】Chef and Graph Queries
    大包子玩游戏
  • 原文地址:https://www.cnblogs.com/yuan9910/p/13999057.html
Copyright © 2011-2022 走看看