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; + } +}