ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 解决nginx: [emerg] unknown directive “stream“ in /etc/nginx/nginx.conf问题

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

原创 Linux操作系统 作者:哈哈哈hh 时间:2022-04-18 14:34:06 0 删除 编辑

镜像下载、域名解析、时间同步请点击  阿里云开源镜像站

问题原因

在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;
    }
}

nginx -t报错

file

解决方法

# 安装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

本文转自:https://blog.csdn.net/weixin_45858439/article/details/122215639


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/70003733/viewspace-2887586/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: OpenStack部署
请登录后发表评论 登录
全部评论

注册时间:2021-09-10

  • 博文量
    280
  • 访问量
    250882