前言
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