🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
1.配置编译增加 `--with-stream` ``` # 创建目录 mkdir -p /var/cache/nginx/client_temp ./configure \ --prefix=/etc/nginx \ --sbin-path=/usr/sbin/nginx \ --conf-path=/etc/nginx/nginx.conf \ --error-log-path=/var/log/nginx/error.log \ --http-log-path=/var/log/nginx/access.log \ --pid-path=/var/run/nginx.pid \ --lock-path=/var/run/nginx.lock \ --http-client-body-temp-path=/var/cache/nginx/client_temp \ --http-proxy-temp-path=/var/cache/nginx/proxy_temp \ --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \ --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \ --http-scgi-temp-path=/var/cache/nginx/scgi_temp \ --user=nginx \ --group=nginx \ --with-http_gunzip_module \ --with-http_gzip_static_module \ --with-stream \ ``` 2.编译安装 ``` make && make install ``` 3. 配置 rabbit_api.conf ``` stream{ upstream rabbitmq_api { server 172.30.2.10:5672 weight=1; } server { listen 11181; proxy_pass rabbitmq_api; } } ``` nginx.conf 增加与http模块平级的配置 ``` include /etc/nginx/conf.d/tcp/*.conf; ```