From 8278136ad184e9aebca18ac4135af9dbb7f193be Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 31 Mar 2026 21:33:14 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20H5=20=E9=9D=99?= =?UTF-8?q?=E6=80=81=E8=B5=84=E6=BA=90=20404=EF=BC=8C=E5=B0=86=E6=9E=84?= =?UTF-8?q?=E5=BB=BA=E4=BA=A7=E7=89=A9=E6=94=BE=E5=88=B0=20/h5/=20?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 4.6 --- Dockerfile | 2 +- docker/nginx.conf | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8bf9390..d435d79 100644 --- a/Dockerfile +++ b/Dockerfile @@ -47,7 +47,7 @@ RUN rm -rf /etc/nginx/conf.d/default.conf COPY docker/nginx.conf /etc/nginx/conf.d/default.conf # 从构建阶段复制构建产物(UniApp H5 输出目录) -COPY --from=builder /build/dist/build/h5 /usr/share/nginx/html +COPY --from=builder /build/dist/build/h5 /usr/share/nginx/html/h5 # 暴露端口 EXPOSE 80 diff --git a/docker/nginx.conf b/docker/nginx.conf index 94468c2..8445fc3 100644 --- a/docker/nginx.conf +++ b/docker/nginx.conf @@ -17,10 +17,14 @@ server { add_header Content-Type text/plain; } - location / { + location /h5/ { try_files $uri $uri/ /index.html; } + location = / { + return 301 /h5/; + } + location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ { expires 1y; add_header Cache-Control "public, immutable";