背景
修改了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指令,但是執(zhí)行了nginx -V
后,發(fā)現(xiàn)輸出內容有相關的stream模塊,這就使我很困惑,為啥nginx識別不到呢?
解法
經(jīng)過查資料和嘗試,發(fā)現(xiàn)安裝nginx-mod-stream
這個庫可以解決這個問題:
$ sudo yum install nginx-mod-stream
測試下,沒問題文章來源:http://www.zghlxwxcb.cn/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文章來源地址http://www.zghlxwxcb.cn/news/detail-734243.html
到了這里,關于解決nginx: [emerg] unknown directive “stream“ in /etc/nginx/nginx.conf的文章就介紹完了。如果您還想了解更多內容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網(wǎng)!