nginx配置tcp负载均衡

stream {
    log_format proxy '$remote_addr [$time_local] '
                 '$protocol $status $bytes_sent $bytes_received '
                 '$session_time "$upstream_addr" '
                 '"$upstream_bytes_sent" "$upstream_bytes_received" "$upstream_connect_time"';
    upstream tcpserver {
        server 10.0.1.2:10001;
        server 10.0.1.3:10001;

    }

    server {
        error_log       /var/log/nginx/tcp_error.log;
        access_log      /opt/log/nginx/tcp_access.log proxy;
        listen 3000;
        proxy_timeout 20s;
        proxy_pass tcpserver ;
    }
}

你可能感兴趣的:(nginx)