美文网首页nginx网络already
【nginx】用 nginx stream 模块实现 tcp/u

【nginx】用 nginx stream 模块实现 tcp/u

作者: Bogon | 来源:发表于2022-07-19 00:04 被阅读0次

    yum -y install epel-release

    yum -y install nginx

    vim /etc/nginx/nginx.conf

    
    # For more information on configuration, see:
    
    #   * Official English Documentation:[http://nginx.org/en/docs/](https://links.jianshu.com/go?to=http%3A%2F%2Fnginx.org%2Fen%2Fdocs%2F)
    
    #   * Official Russian Documentation:[http://nginx.org/ru/docs](https://links.jianshu.com/go?to=http%3A%2F%2Fnginx.org%2Fru%2Fdocs)/
    
    user nginx;
    
    worker_processes auto;
    
    error_log /var/log/nginx/error.log;
    
    pid /run/nginx.pid;
    
    # Load dynamic modules. See /usr/share/nginx/README.dynamic.
    
    include /usr/share/nginx/modules/*.conf;
    
    events {
    
        worker_connections 1024;
    
    }
    
    ##############################
    stream {
        proxy_timeout 30s;
        upstream stream_backend {
            server 192.168.170.41:8080;
            server 192.168.170.42:8080;
    }
    
    server {
        listen 8080;
        proxy_pass stream_backend;
       }
    }
    #################################
    

    systemctl start nginx

    systemctl enable nginx

    systemctl status nginx

    image.png

    参考

    TCP和UDP的负载均衡
    https://mp.weixin.qq.com/s/T6Axis20oJg29IXbXuZCoA

    Nginx - UDP健康检查介绍
    https://mp.weixin.qq.com/s/vrUKoOEd4osuRe9PmBDVGw

    用stream模块实现TCP端口转发
    https://www.jianshu.com/p/d6396d8c5418

    Module ngx_stream_proxy_module
    https://nginx.org/en/docs/stream/ngx_stream_proxy_module.html

    TCP/UDP Load Balancing with NGINX: Overview, Tips, and Tricks
    https://www.nginx.com/blog/tcp-load-balancing-udp-load-balancing-nginx-tips-tricks

    NGINX as a Reverse Stream Proxy
    https://www.eigenmagic.com/2021/09/20/nginx-as-a-reverse-stream-proxy

    nginx stream proxy vs http proxy for ssl termination
    https://serverfault.com/questions/1011928/nginx-stream-proxy-vs-http-proxy-for-ssl-termination

    nginx reverse stream proxy with multiple ports to the same server
    https://serverfault.com/questions/850714/nginx-reverse-stream-proxy-with-multiple-ports-to-the-same-server

    相关文章

      网友评论

        本文标题:【nginx】用 nginx stream 模块实现 tcp/u

        本文链接:https://www.haomeiwen.com/subject/odctirtx.html