背景
修改了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
测试下,没问题
$ nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
|