|
|
@@ -0,0 +1,34 @@
|
|
|
+server
|
|
|
+{
|
|
|
+ # 匹配路径:/ 、/about/ 、/.nuxt/* 、/channel/* 、/page/*
|
|
|
+ # 用 ~* 实现不区分大小写匹配(可选,如需严格大小写可改为 ~)
|
|
|
+ location ~* ^(/|/about/|/inheritor/.*|/\.nuxt/.*|/\_nuxt/.*|/channel/.*|/page/.*|/api/ecms/.*)$ {
|
|
|
+ # 1. 核心:反向代理至目标服务 localhost:3106
|
|
|
+ proxy_pass http://localhost:3106;
|
|
|
+
|
|
|
+ # 2. 关键:禁用反向代理缓存(多维度兜底,确保无缓存)
|
|
|
+ # 2.1 告诉后端服务不缓存当前请求
|
|
|
+ proxy_cache off; # 直接关闭 Nginx 代理缓存(核心配置)
|
|
|
+ proxy_no_cache 1; # 强制不缓存响应内容
|
|
|
+ proxy_cache_bypass 1; # 强制绕过缓存,直接请求后端
|
|
|
+
|
|
|
+ # 2.2 响应头:告诉客户端(浏览器)不缓存
|
|
|
+ add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0";
|
|
|
+ add_header Pragma "no-cache";
|
|
|
+ add_header Expires "0";
|
|
|
+ add_header Surrogate-Control "no-store";
|
|
|
+
|
|
|
+ # 3. 可选:优化反向代理的常规配置(保证服务稳定性)
|
|
|
+ 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_connect_timeout 30s; # 连接超时时间
|
|
|
+ proxy_send_timeout 30s; # 发送超时时间
|
|
|
+ proxy_read_timeout 30s; # 读取超时时间
|
|
|
+ proxy_buffering off; # 关闭代理缓冲(实时响应,同时避免缓存)
|
|
|
+ }
|
|
|
+
|
|
|
+ access_log /www/wwwlogs/xmswhycbhzx.cn.log;
|
|
|
+ error_log /www/wwwlogs/xmswhycbhzx.cn.error.log;
|
|
|
+}
|