一、安装nginx 添加 stream 模块
#--with-stream 导入 stream
./configure --prefix=/usr/local/nginx-1.20.2 --with-stream --with-pcre=/data/software/pcre-8.45 --with-zlib=/data/software/zlib-1.2.11
二、编译安装
make
make install
三、配置
vi conf/nginx.conf
stream{
include tcp.conf/*.conf;
server{
listen 443 so_keepalive=on;
listen 8081 so_keepalive=on;
proxy_connect_timeout 2s;
proxy_pass linkv-im-live;
tcp_nodelay on;
}
}
mkdir tcp.conf
vi tcp.conf/tcp_live.conf
upstream linkv-im-live {
server hostname:10001;#site=origin
server hostname2:80 backup;#site=origin
}
backup 添加备份节点,当配置节点无法连通时,连通备用节点