nginx检查提示“unknown directive "stream" in /etc/*/nginx.conf”
yum安装nginx检查时提示“unknown directive "stream" in /etc/nginx/nginx.conf”
yum安装nginx,在配置反代时,出现错误:
nginx -t
nginx: [emerg] unknown directive "stream" in /etc/nginx/nginx.conf:90
nginx: configuration file /etc/nginx/nginx.conf test failed

网上的解决办法:
在nginx.conf的第一行插入:
load_module /usr/lib/nginx/modules/ngx_stream_module.so;
但是再次检查依然无法通过,提示没有找到文件或者目录
nginx -t
nginx: [emerg] dlopen() "/usr/lib/nginx/modules/ngx_stream_module.so" failed (/usr/lib/nginx/modules/ngx_stream_module.so: cannot open shared object file: No such file or directory) in /etc/nginx/nginx.conf:1
nginx: configuration file /etc/nginx/nginx.conf test failed
经过分析,yum安装的nginx版本,没有安装stream模块
使用命令:yum list |grep nginx查找可安装的stream模块

安装nginx-mod-stream:
yum install nginx-mod-stream -y
再次执行nginx -t检查,检查通过。
nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
相关推荐
-
MySQL 安装失败,提示Apply Security Settings 的处理办法
MySQL 安装失败,提示Apply Security Settings 的处理办法2025-04-20 01:54:57 -
MySQL事务隔离级别详解2025-04-20 01:44:01
-
一文说清nginx规则匹配(含案例分析)2025-04-20 01:10:02
-
运维服务篇:Nginx常用功能(rewrite重定向/location定位等)
运维服务篇:Nginx常用功能(rewrite重定向/location定位等)2025-04-20 00:55:25 -
php定义变量规则不能包含哪些字符?2025-04-20 00:27:24