当前位置: 首页 > news >正文

nginx 负载均衡配置

报错nginx: [emerg] invalid host in upstream "10.67.208.182:7443/yqbapi/" in /usr/local/nginx/conf/nginx.conf:37

upstream 后面不能直接更名字,可以在loccation里面配置

upstream backend {server 192.168.1.182:7443;  # ✅ 只写 IP:Portserver 192.168.1.182:7444; 
}server {location /api/ {#rewrite ^/api(.*)$ $1 break;  过滤掉apiproxy_pass http://backend/api/;  # 路径在这里指定}
}

---常用配置

location /ai_api {	rewrite ^/ai_api(.*)$ $1 break;proxy_set_header Host $host:$server_port;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;proxy_set_header X-Real-IP $remote_addr;proxy_http_version 1.1;proxy_set_header Upgrade $http_upgrade;proxy_set_header Connection 'upgrade';proxy_cache off;proxy_buffering off;      # 禁用缓冲proxy_buffer_size 4k;     # 减小缓冲区大小,加快首包返回proxy_read_timeout 300s;  # 可适当调大超时时间(根据业务)proxy_send_timeout 300s;proxy_pass http://127.0.0.1:8001;}    location /ollama {rewrite ^/ollama(.*)$ $1 break;proxy_pass http://127.0.0.1:5612; #python 接口proxy_set_header Host $host;proxy_set_header X-Real-IP $remote_addr;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;proxy_set_header X-Forwarded-Proto $scheme;proxy_cache off;  #关闭缓存proxy_buffering off;  #关闭代理缓冲chunked_transfer_encoding on;  #开启分块传输编码tcp_nopush on;  #开启TCP NOPUSH选项,禁止Nagle算法tcp_nodelay on;  #开启TCP NODELAY选项,禁止延迟ACK算法keepalive_timeout 300;  #设定keep-alive超时时间为300秒}

http://www.dtcms.com/a/477672.html

相关文章:

  • 原生 iOS 开发全流程实战,Swift 技术栈、工程结构、自动化上传与上架发布指南
  • Apache开源许可证:深度解析与实践指南
  • Python Web开发——HTTP协议简介
  • 病理切片可解释性分析-细胞类型、核形态与细胞间相互作用
  • 【C语言】杨辉三角:数学之美与编程实现的完美结合
  • 盐城网站建设策划方案杭州企业求网站建设
  • 基于.NET Framework 4.0的串口通信
  • Mybatis Log Free插件使用
  • asp网站可运行jsp吗专做立体化的网站
  • angie未生成coredump文件
  • 【leetcode刷题007】leetcode116、117
  • 南昌网站推广¥做下拉去118cr如何做实验室网站
  • 从0开始搭建Vue3项目
  • 【知识】Linux将多条指令合并为一条执行
  • 将 MapReduce 程序打成 JAR 包并在 Linux 虚拟机的 Hadoop 集群上运行
  • 06_Miniconda零基础安装配置指南:打造高效的Python开发环境
  • 量子计算与AI融合:材料科学新突破!!
  • 徐州网站建设方案咨询外贸牛
  • 顶级 AI 模型横评:智能、性能与价格等方面全面对比
  • Vuex 详细用法(Vue2 和 Vue3)
  • 注册公司网站如何注册黑龙江公共资源交易网官网
  • 如何将iPhone上的HEIF图像下载到电脑
  • 欧洲宇航局使用Varjo XR头戴设备为宇航员提供虚拟现实空间站任务训练
  • iphone IOS3~IOS9游戏 旧iphone 单机游戏合集分享
  • 昂瑞微冲刺科创板:硬科技与资本市场的双向奔赴
  • 从入门到精通【Redis】Redis 典型应⽤ --- 缓存 (cache)
  • 【深入理解计算机网络10】UDP协议详解
  • 宁波网站建设模板制作什么叫优化
  • 自动裁剪图(电商使用)
  • 大模型应用开发