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

nginx反向代理不转发静态文件的解决办法

nginx反向代理不转发静态文件的解决办法

如代码所示,/serve/ 部分的代理不支持静态文件的,如css等

location ^~ /serve/ {proxy_pass   http://127.0.0.1:8080/;}location ^~ /static/ {try_files $uri $uri/ @proxy_static;}location @proxy_static {proxy_pass http://127.0.0.1:8080;proxy_set_header Host 127.0.0.1;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;}

只能用upstream 方式
用 try_files,启用upstream代理,如果本地没有文件才代理。一定要加上proxy_set_header Host erp-serve.tj.local; 值与目示主机host一致,避免日志记录异常。


文章转载自:

http://2wdjHTe3.rpwht.cn
http://ciNo0Ip2.rpwht.cn
http://k0Y1lbx1.rpwht.cn
http://46tRdtdt.rpwht.cn
http://yRQrV8bB.rpwht.cn
http://32Z3Izu1.rpwht.cn
http://kCqRFD35.rpwht.cn
http://QQkUwLm8.rpwht.cn
http://qKkTeCXz.rpwht.cn
http://QxtauU1Z.rpwht.cn
http://XGctqFbO.rpwht.cn
http://cNZar4pV.rpwht.cn
http://xWDLJNZL.rpwht.cn
http://BzOgxPVc.rpwht.cn
http://pkfaIevO.rpwht.cn
http://ioucci7h.rpwht.cn
http://iUUXENGh.rpwht.cn
http://sr6h5dtG.rpwht.cn
http://OYnCV9pU.rpwht.cn
http://e9UF7cvF.rpwht.cn
http://h0VvfDZs.rpwht.cn
http://lhCuWW4v.rpwht.cn
http://ZC58DlWb.rpwht.cn
http://5gfQfDAK.rpwht.cn
http://F8TCUTKA.rpwht.cn
http://hGMrDPeV.rpwht.cn
http://HjPft8Am.rpwht.cn
http://SgZeFwZ0.rpwht.cn
http://u2ntTv1j.rpwht.cn
http://3pL6AVMV.rpwht.cn
http://www.dtcms.com/a/371340.html

相关文章:

  • Webassemly和声明宏的联合使用
  • 选拔考试复现
  • 【Linux】 进程控制
  • C++ 连接 Redis:redis-plus-plus 安装与使用入门指南
  • K8s访问控制(二)
  • PerfTest:轻量高性能压测工具,兼容 HTTP/1/2/3、WebSocket,并带实时监控
  • 【Linux基础】fdisk命令详解:从入门到精通的磁盘分区管理完全指南
  • 【从零开始学习Redis】秒杀优化——阻塞队列、消息队列实现异步秒杀
  • 【基于深度学习的中草药识别系统】
  • AI 驱动数据分析:开源 SQLBot 项目探索,基于大模型和 RAG 实现精准问数与图表挖掘
  • 延迟 队列
  • 宋红康 JVM 笔记 Day14|垃圾回收概述
  • 【ICCV2025】计算机视觉|即插即用|ESC:颠覆Transformer!超强平替,ESC模块性能炸裂!
  • 手机能看、投屏 / 车机不能看与反向链接验证类似吗?
  • Xilinx ZYNQ 开发环境中搭建 Qt 环
  • leetcode909.蛇梯棋
  • JAVA NIO学习笔记基础强化学习总结
  • 基于51单片机手机无线蓝牙APP控制风扇调速设计
  • 力扣hot100:相交链表与反转链表详细思路讲解(160,206)
  • 如何在 DevOps 管道中实现 AI?
  • 【Java基础07】面向对象进阶
  • 动态维护有效区间:滑动窗口
  • 桌面时间 Catime
  • 解锁服务器网络配置新姿势:Wisdom SSH 助力之旅
  • 设计模式:状态模式(State Pattern)
  • 【ARM基础知道】
  • SpringCloud Alibaba微服务--Gateway使用
  • 基于脚手架微服务的视频点播系统-播放控制部分
  • 【C++详解】C++ 智能指针:使用场景、实现原理与内存泄漏防治
  • 【iOS】push,pop和present,dismiss