hfjDream 2021-07-21 10:27 采纳率: 60%
浏览 975
已结题

执行nginx -t 提示nginx配置文件中不允许使用“stream”指令?

root@wsy-message4 sbin]# ./nginx -V
nginx version: nginx/1.18.0
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC)
built with OpenSSL 1.0.2k-fips 26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/usr/etc/nginx --sbin-path=/usr/etc/nginx/sbin/nginx--error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --user=wssuser --group=wssuser --with-http_ssl_module --with-threads --with-http_realip_module --with-http_gzip_static_module --http-proxy-temp-path=/var/tmp/nginx/proxy/ --with-http_stub_status_module --http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ --http-scgi-temp-path=/var/tmp/nginx/scgi --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi --add-module=../nginx_upstream_check_module-master --with-pcre --with-stream
[root@wsy-message4 sbin]# nginx -t
nginx: [emerg] "stream" directive is not allowed here in /usr/etc/nginx/conf/conf.d/ab_pay_gateway.conf:26
nginx: configuration file /usr/etc/nginx/conf/nginx.conf test failed

配置文件格式:
stream{
upstream rabbitTcp{
server 172.16.15.17:5672;
server 172.16.15.18:5672;
}

server {
    listen 8080;
   
    location /rbweb/{ 
 proxy_pass rabbitTcp;
 }

}
}

img

  • 写回答

3条回答 默认 最新

  • gammey 2021-07-23 18:01
    关注

    你这个是tcp协议代理,默认你这个版本里应该不是这样写的。你可以搜下nginx tcp_proxy,有相应的module和文档。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

问题事件

  • 系统已结题 8月4日
  • 已采纳回答 7月27日
  • 创建了问题 7月21日