nginx 配置stream模块代理并开启日志配置

前言

nginx 1.20.1
nginx从1.9.0开始,新增加了一个stream模块
确保nginx 安装时开启stream模块

./configure \ 
…… \
--with-stream \ --with-stream_ssl_module \

修改nginx.conf

#增加stream配置,开启stream模块

stream {
    log_format basic '$remote_addr [$time_local] '
                     '$protocol $status $bytes_sent $bytes_received '
                     '$session_time';
    access_log logs/stream-access.log basic buffer=32k;

    server{
        listen 6666;
        proxy_pass 10.11.11.11:7777;
    }
}

重新加载配置

# 测试一下配置文件写的是否有问题
shell> nginx -t
# 配置文件没问题的话,重新加载配置
shell> nginx -s reload

 

posted @ 2021-09-17 17:37  渊渟岳  阅读(2875)  评论(0编辑  收藏  举报