first commit

This commit is contained in:
2025-07-08 11:21:52 +08:00
commit 076e80b491
46 changed files with 6644 additions and 0 deletions

45
nginx.conf Normal file
View File

@@ -0,0 +1,45 @@
server {
listen 8080;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
# 启用 gzip 压缩
gzip on;
gzip_vary on;
gzip_min_length 1024;
gzip_proxied any;
gzip_types
text/plain
text/css
text/xml
text/javascript
application/javascript
application/xml+rss
application/json;
# 处理静态资源
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
expires 1y;
add_header Cache-Control "public, immutable";
try_files $uri =404;
}
# SPA 路由支持 - 关键配置
location / {
try_files $uri $uri/ @fallback;
}
# 回退到 index.html这是 SPA 路由的核心
location @fallback {
rewrite ^.*$ /index.html last;
}
# 安全头部
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
# 错误页面
error_page 404 /index.html;
}