解决Nginx unknown directive “stream”问题

03-03 5507阅读 0评论

背景

解决Nginx unknown directive “stream”问题 第1张
(图片来源网络,侵删)

Nginx代理渠道接口的 tcp 端口时报错:unknown directive “stream”

解决

编译时,通过添加 –with-stream参数来安装 stream 模块。

需要手工加载 ngx_stream_module.so 模块。

#安装到/home/ jjtg6/soft/nginx-1.6.3,关联软件路径根据上面解压路径确定
[/home/jjtg6/soft] cd nginx-1.6.3/
[/home/jjtg6/soft/nginx-1.6.3]./configure--prefix=/home/hstc61/nginx-1.6.3 --with-openssl=/home/hstc61/openssl-1.1.1k --with-pcre=/home/hstc61/pcre-8.35  --with-zlib=/home/hstc61/zlib-1.2.11 --with-stream
#编译
[/home/jjtg6/soft/nginx-1.6.3]make
[/home/jjtg6/soft/nginx-1.6.3]make install
检查版本
[/home/jjtg6/nginx-1.6.3/sbin]./nginx -v
nginxversion: nginx/1.6.3

操作系统信息

$ uname -a

解决Nginx unknown directive “stream”问题 第2张
(图片来源网络,侵删)

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;


免责声明
1、本网站属于个人的非赢利性网站,转载的文章遵循原作者的版权声明。
2、本网站转载文章仅为传播更多信息之目的,凡在本网站出现的信息,均仅供参考。本网站将尽力确保所
提供信息的准确性及可靠性,但不保证信息的正确性和完整性,且不对因信息的不正确或遗漏导致的任何
损失或损害承担责任。
3、任何透过本网站网页而链接及得到的资讯、产品及服务,本网站概不负责,亦不负任何法律责任。
4、本网站所刊发、转载的文章,其版权均归原作者所有,如其他媒体、网站或个人从本网下载使用,请在
转载有关文章时务必尊重该文章的著作权,保留本网注明的“稿件来源”,并白负版权等法律责任。

手机扫描二维码访问

文章版权声明:除非注明,否则均为主机测评原创文章,转载或复制请以超链接形式并注明出处。

发表评论

快捷回复: 表情:
评论列表 (暂无评论,5507人围观)

还没有评论,来说两句吧...

目录[+]