Nginx 四层最佳配置

Nginx 刘宇帅 1年前 阅读量: 366

stream {
    log_format proxy 'time=[$time_local] remote_addr=[$remote_addr]'
                 ' protocol=[$protocol] status=[$status] byte_send=[$bytes_sent] byte_received=[$bytes_received] '
                 'session_time=[$session_time] upstream_addr=[$upstream_addr] '
                 'upstream_bytes_sent=[$upstream_bytes_sent] upstream_bytes_received=[$upstream_bytes_received] upstream_connect_time=[$upstream_connect_time]';

    upstream user_proxy_80 {
        server yourIp:80;
    }
    server {
        listen 80;
        proxy_connect_timeout 1s;
        proxy_timeout 10s;
        proxy_pass user_proxy_80;
            access_log /var/log/nginx/proxy-80-access.log proxy;
    }

    upstream user_proxy_443 {
        server yourIp:443;
    }
    server {
        listen 443;
        proxy_connect_timeout 1s;
        proxy_timeout 10s;
        proxy_pass user_proxy_443;
        access_log /var/log/nginx/proxy-80-access.log proxy;
    }
}

提示

功能待开通!


暂无评论~