All checks were successful
Build and Deploy Web / build-and-deploy (push) Successful in 1m14s
24 lines
533 B
Nginx Configuration File
24 lines
533 B
Nginx Configuration File
server {
|
|
listen 80;
|
|
server_name localhost;
|
|
|
|
location / {
|
|
root /usr/share/nginx/html;
|
|
index index.html index.htm;
|
|
# 解决 SPA 路由刷新 404 的关键配置
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
|
|
# 静态资源缓存配置 (可选优化)
|
|
location /assets/ {
|
|
root /usr/share/nginx/html;
|
|
expires 7d;
|
|
add_header Cache-Control "public";
|
|
}
|
|
|
|
error_page 500 502 503 504 /50x.html;
|
|
location = /50x.html {
|
|
root /usr/share/nginx/html;
|
|
}
|
|
}
|