From 808262fdf497af823b06f46fc3cf20972a8ff028 Mon Sep 17 00:00:00 2001
From: yeg <1347747024@qq.com>
Date: 星期二, 29 九月 2026 12:56:49 +0800
Subject: [PATCH] docs(server): 补 nginx 共享 location snippet

---
 .scratch/server-testenv/nginx-talent-card-locations.conf |   37 +++++++++++++++++++++++++++++++++++++
 1 files changed, 37 insertions(+), 0 deletions(-)

diff --git a/.scratch/server-testenv/nginx-talent-card-locations.conf b/.scratch/server-testenv/nginx-talent-card-locations.conf
new file mode 100644
index 0000000..1a68968
--- /dev/null
+++ b/.scratch/server-testenv/nginx-talent-card-locations.conf
@@ -0,0 +1,37 @@
+# 东区人才卡 —— 共享 location(8081 与将来的 80/443 用同一份,避免两处漂移)
+#
+# 部署位置:/etc/nginx/snippets/talent-card-locations.conf
+# 由 sites-available/talent-card 里的每个 server 块 include。include 是在 server 上下文展开的,
+# 所以下面的 client_max_body_size / proxy_*_timeout 都是合法位置。
+
+# 后端 spring.servlet.multipart.max-file-size 是 10MB,而 nginx 默认只放 1MB,
+# 不抬高的话图片上传会在 nginx 这层就 413,看后端日志什么都没有。
+client_max_body_size 20m;
+
+# 进件/开通这类要打通道的接口慢,留出余量
+proxy_read_timeout 120s;
+proxy_send_timeout 120s;
+
+location /api/ {
+    proxy_pass http://127.0.0.1:8080;
+    proxy_http_version 1.1;
+    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;
+}
+
+# 上传的图片由后端自己托管(UploadResourceConfig 把 /uploads/** 映射到 app.upload.directory),
+# 所以这里只转发,不要用 alias 指向磁盘 —— 两处指向同一个目录早晚会不一致。
+location /uploads/ {
+    proxy_pass http://127.0.0.1:8080;
+    proxy_set_header Host $host;
+    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+    proxy_set_header X-Forwarded-Proto $scheme;
+}
+
+# 后台管理端 SPA
+location / {
+    root /data/talent-card/admin;
+    try_files $uri $uri/ /index.html;
+}

--
Gitblit v1.7.1