解决nginx: [emerg] unknown directive “stream“ in /etc/nginx/nginx.conf问题

解决nginx: [emerg] unknown directive “stream“ in /etc/nginx/nginx.conf问题
          本文链接:https://blog.csdn.net/weixin_45858439/article/details/122215639
           
  

问题原因 
在nginx中增加了这个配置 
[root@k8s-node2 ~]# cat /etc/nginx/nginx.conf
stream {
    upstream kube-apiserver {
        server 192.168.10.64:6443     max_fails=3 fail_timeout=30s;
        server 192.168.10.65:6443     max_fails=3 fail_timeout=30s;
    }
    server {
        listen 7443;
        proxy_connect_timeout 2s;
        proxy_timeout 900s;
        proxy_pass kube-apiserver;
    }
}

1234567891011121314 
nginx -t报错  
解决方法 
# 安装nginx源
curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
# 先安装
yum -y install epel-release

#应该是缺少modules模块
yum -y install nginx-all-modules.noarch
然后在用nginx -t就好了
[root@k8s-node2 ~]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
————————————————
版权声明:本文为CSDN博主「一个不专业的码农」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weixin_45858439/article/details/122215639

你可能感兴趣的:(转载,linux)