From e4aef57047588648382c4b6d57b087ef3d287c07 Mon Sep 17 00:00:00 2001 From: Vaica <94612053+zqlit@users.noreply.github.com> Date: Mon, 22 Jun 2026 12:31:07 +0800 Subject: [PATCH] 1231 --- write-server/nginx/conf.d/write-server.conf | 3 +-- write-server/src/lib/hugo.ts | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/write-server/nginx/conf.d/write-server.conf b/write-server/nginx/conf.d/write-server.conf index d15a402f..cbf11646 100644 --- a/write-server/nginx/conf.d/write-server.conf +++ b/write-server/nginx/conf.d/write-server.conf @@ -51,8 +51,7 @@ server { # Hugo 预览代理(不需要认证) location /preview/ { auth_request off; - rewrite ^/preview/(.*)$ /$1 break; - proxy_pass http://write-server:1313; + proxy_pass http://write-server:1313/preview/; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; } diff --git a/write-server/src/lib/hugo.ts b/write-server/src/lib/hugo.ts index dbf1a3d9..7a056ad3 100644 --- a/write-server/src/lib/hugo.ts +++ b/write-server/src/lib/hugo.ts @@ -18,7 +18,7 @@ class HugoManager { this.starting = true; this.ready = false; - this.process = spawn("hugo", ["server", "--bind", "0.0.0.0", "--port", "1313", "--disableFastRender", "--noHTTPCache"], { + this.process = spawn("hugo", ["server", "--bind", "0.0.0.0", "--port", "1313", "--baseURL", "/preview/", "--disableFastRender", "--noHTTPCache"], { cwd: BLOG_ROOT, shell: true, stdio: "pipe",