登录  /  注册
博主信息
博文 291
粉丝 0
评论 0
访问量 431481
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
解决nginx: [emerg] unknown directive “stream“ in /etc/nginx/nginx.conf问题
原创
6227人浏览过

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

问题原因

在nginx中增加了这个配置

  1. [root@k8s-node2 ~]# cat /etc/nginx/nginx.conf
  2. stream {
  3. upstream kube-apiserver {
  4. server 192.168.10.64:6443 max_fails=3 fail_timeout=30s;
  5. server 192.168.10.65:6443 max_fails=3 fail_timeout=30s;
  6. }
  7. server {
  8. listen 7443;
  9. proxy_connect_timeout 2s;
  10. proxy_timeout 900s;
  11. proxy_pass kube-apiserver;
  12. }
  13. }

nginx -t报错

file

解决方法

  1. # 安装nginx源
  2. curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
  3. # 先安装
  4. yum -y install epel-release
  5. #应该是缺少modules模块
  6. yum -y install nginx-all-modules.noarch
  7. 然后在用nginx -t就好了
  8. [root@k8s-node2 ~]# nginx -t
  9. nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
  10. nginx: configuration file /etc/nginx/nginx.conf test is successful

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

本博文版权归博主所有,转载请注明地址!如有侵权、违法,请联系admin@php.cn举报处理!
全部评论 文明上网理性发言,请遵守新闻评论服务协议
0条评论
作者最新博文
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号

  • 登录PHP中文网,和优秀的人一起学习!
    全站2000+教程免费学