fix(5):调整nginx配置,解决仅能通过根目录访问的问题
This commit is contained in:
@@ -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
|
||||
|
||||
+21
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user