// 安装 nginx

    $ yum -y install nginx

    // 代理 rancher 四层协议

    $ vim /etc/nginx/nginx.conf
    worker_processes 4;
    worker_rlimit_nofile 40000;
    
    events {
        worker_connections 8192;
    }
    
    stream {
        upstream rancher_servers_http {
            least_conn;
            server 192.168.10.201:80 max_fails=3 fail_timeout=5s;
            server 192.168.10.202:80 max_fails=3 fail_timeout=5s;
        }
        server {
            listen 80;
            proxy_pass rancher_servers_http;
        }
    
        upstream rancher_servers_https {
            least_conn;
            server 192.168.10.201:443 max_fails=3 fail_timeout=5s;
            server 192.168.10.202:443 max_fails=3 fail_timeout=5s;
        }
        server {
            listen     443;
            proxy_pass rancher_servers_https;
        }
    }

    //启动 nginx 报错

    $ systemctl start nginx
    $ systemctl status nginx
    ...
    Jan 31 15:52:06 c710239.xiodi.cn nginx[20266]: nginx: [emerg] unknown directive "stream" in /etc/nginx/nginx.conf:8
    Jan 31 15:52:06 c710239.xiodi.cn nginx[20266]: nginx: configuration file /etc/nginx/nginx.conf test failed
    ...

    // 缺少模块

    $ yum -y install nginx-mod-stream
    $ vim /etc/nginx/nginx.conf      // 载入模块
    load_module /usr/lib64/nginx/modules/ngx_stream_module.so;
    worker_processes 4;
    worker_rlimit_nofile 40000;
    ...
    
    $ systemctl start nginx