From 54dd8b2a2da717ab44a57a7ad95011de587a9bca Mon Sep 17 00:00:00 2001 From: cat_shark <1716967236@qq.com> Date: Tue, 5 Aug 2025 14:37:40 +0800 Subject: [PATCH] =?UTF-8?q?fix(5)=EF=BC=9A=E8=B0=83=E6=95=B4nginx=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=EF=BC=8C=E8=A7=A3=E5=86=B3=E4=BB=85=E8=83=BD=E9=80=9A?= =?UTF-8?q?=E8=BF=87=E6=A0=B9=E7=9B=AE=E5=BD=95=E8=AE=BF=E9=97=AE=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 3 +++ nginx.conf | 21 +++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 nginx.conf diff --git a/Dockerfile b/Dockerfile index d73c8c8..6f55a2e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,4 +4,7 @@ FROM nginx:alpine RUN apk add --no-cache curl COPY dist/ /usr/share/nginx/html/ + +COPY nginx.conf /etc/nginx/conf.d/default.conf + EXPOSE 80 diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..0023d74 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,21 @@ +server { + listen 80; + server_name localhost; + + location / { + root /usr/share/nginx/html; + index index.html index.htm; + try_files $uri $uri/ /index.html; # 关键配置 + } + + # 可选:健康检查路径(如果有) + location /health { + access_log off; + return 200 'healthy'; + } + + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; + } +}