feat: Add base project structure with API and web components

This commit is contained in:
Ke Sun
2025-12-02 20:28:01 +08:00
parent f3de6d6cc9
commit c1adc62ec6
817 changed files with 111226 additions and 106 deletions

45
web/nginx.conf.example Normal file
View File

@@ -0,0 +1,45 @@
# Nginx 配置示例
# 用于部署 React + Vite 应用
server {
listen 80;
server_name your-domain.com; # 替换为你的域名
root /var/www/html/dist; # 替换为你的项目路径
index index.html;
# 启用 gzip 压缩
gzip on;
gzip_vary on;
gzip_min_length 1024;
gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml+rss application/javascript application/json;
# 设置正确的 MIME 类型
include /etc/nginx/mime.types;
default_type application/octet-stream;
# 静态资源缓存
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/ /index.html;
add_header Cache-Control "no-cache, no-store, must-revalidate";
}
# API 代理(如果需要)
location /api/ {
proxy_pass http://119.45.181.55:8000/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
# 错误页面
error_page 404 /index.html;
}