diff --git a/nginx-static-production.conf b/nginx-static-production.conf index 25551a8..80586f4 100644 --- a/nginx-static-production.conf +++ b/nginx-static-production.conf @@ -198,11 +198,12 @@ http { } # Next.js 静态导出的页面路由 + ISR/SSR 回源 - # 1) 优先命中已构建的静态 HTML/资源 + # 1) 优先命中已构建的静态 HTML/资源(含目录 index.html) # 2) 未命中时转交给 Next.js 运行时(ISR 首次渲染、Draft 预览、动态路由) + # 注意:不能用 $uri/ 兜底目录,否则根路径会因目录无 index.html 直接 403 而不是回源 location / { limit_req zone=general burst=20 nodelay; - try_files $uri $uri.html $uri/ @nextjs; + try_files $uri $uri.html $uri/index.html @nextjs; } # ISR/SSR 回源 named location