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