首先要把stream和stream_ssl_preread_module编译进nginx。

[email protected]:~# nginx -V
nginx version: nginx/1.16.0
built by gcc 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 
configure arguments: --with-stream --with-stream_ssl_preread_module --with-openssl=../openssl-1.1.0k

直接上配置

stream {
    map $ssl_preread_server_name $backend_pool {
        prod.cloud.rockstargames.com prod_cloud;
        conductor-prod.ros.rockstargames.com conductor_prod;
        prod.p01sjc.pod.rockstargames.com prod_p01sjc;
    }
    
    upstream prod_cloud {
        server prod.cloud.rockstargames.com:443;
    }

    upstream conductor_prod {
        server conductor-prod.ros.rockstargames.com:443;
    }

    upstream prod_p01sjc {
        server prod.p01sjc.pod.rockstargames.com:443;
    }
    
    server {
        listen 443;
        ssl_preread on;
        proxy_pass $backend_pool;
        proxy_connect_timeout 15s;
        proxy_timeout 15s;
        proxy_next_upstream_timeout 15s;
    }
}

标签: nginx

添加新评论