Web负载均衡学习笔记之nginx: [emerg] unknown directive “stream“ in /etc/nginx/nginx.conf
0x00 概述
yum安装nginx后,启动nginx报错,报错信息如下:
nginx: [emerg] unknown directive “stream“ in /etc/nginx/nginx.conf
nginx配置文件如下,配合keepalived使用:
[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; } }
0x01 解决方法
# 安装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
分类:
Web负载均衡学习笔记
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?