背景
修改了nginx.conf
的配置,增加了stream
相关的配置后,重启Nginx,报错
$ systemctl restart nginx
Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.
$ nginx -t
nginx: [emerg] unknown directive "stream" in /etc/nginx/nginx.conf:29
nginx: configuration file /etc/nginx/nginx.conf test failed
看错误提示是不能识别stream指令,但是执行了nginx -V
后,发现输出内容有相关的stream模块,这就使我很困惑,为啥nginx识别不到呢?
解法
经过查资料和尝试,发现安装nginx-mod-stream
这个库可以解决这个问题:
$ sudo yum install nginx-mod-stream
测试下,没问题文章来源:https://www.toymoban.com/news/detail-734243.html
$ nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
参考资料1文章来源地址https://www.toymoban.com/news/detail-734243.html
到了这里,关于解决nginx: [emerg] unknown directive “stream“ in /etc/nginx/nginx.conf的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!