前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Nginx(Tengine) 解决 unknown directive "stream" 问题​

Nginx(Tengine) 解决 unknown directive "stream" 问题​

作者头像
叨叨软件测试
发布2021-07-16 17:07:44
4.2K0
发布2021-07-16 17:07:44
举报
文章被收录于专栏:叨叨软件测试

背景

Nginx(Tengine) 代理 Bitbucket 的 tcp 端口时报错:unknown directive "stream", 记录下~

解决

  1. 编译时,通过添加 --with-stream 参数来安装 stream 模块。
  2. 需要手工加载 ngx_stream_module.so 模块。
代码语言:javascript
复制
# 操作系统信息
$ uname -a
Linux oa2 3.10.0-1160.31.1.el7.x86_64 #1 SMP Thu Jun 10 13:32:12 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
$ cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)

# Nginx 编译信息
$ ./nginx -V
Tengine version: Tengine/2.3.3
nginx version: nginx/1.18.0
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
built with OpenSSL 1.0.2k-fips  26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_ssl_module --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module --with-http_gzip_static_module --with-http_addition_module --with-stream --with-stream=dynamic --with-stream_ssl_module --with-stream_realip_module --with-http_dav_module --http-proxy-temp-path=/usr/local/nginx/tmp/proxy --http-client-body-temp-path=/usr/local/nginx/tmp/client --http-fastcgi-temp-path=/usr/local/nginx/tmp/fastcgi --http-uwsgi-temp-path=/usr/local/nginx/tmp/uwsgi --http-scgi-temp-path=/usr/local/nginx/tmp/scgi --add-module=/tmp/tengine-2.3.3/modules/ngx_http_upstream_check_module --add-module=/tmp/tengine-2.3.3/modules/ngx_http_proxy_connect_module

# 报错信息
$ ./nginx -t
nginx: [emerg] unknown directive "stream" in /usr/local/nginx/conf/nginx.conf:11
nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed

# nginx.conf 第一行加入
$ vi /usr/local/nginx/conf/nginx.conf
load_module /usr/local/nginx/modules/ngx_stream_module.so;
.......

参考

https://serverfault.com/questions/858067/unknown-directive-stream-in-etc-nginx-nginx-conf86

本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2021-06-28,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 叨叨软件测试 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 背景
  • 解决
  • 参考
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档