server {
    listen 80;
    server_name localhost;  # 替换为您的域名
    
    root /usr/share/nginx/html;  # 替换为您的项目构建后的文件路径
    index index.html;

    location / {
        try_files $uri $uri/ /index.html;  # 将所有请求重定向到index.html
        add_header Cache-Control "no-cache, no-store, must-revalidate";
        add_header Pragma "no-cache";
        add_header Expires "0";
    }

    # 静态资源缓存设置
    location /assets {
        expires 1y;
        add_header Cache-Control "public";
        access_log off;
    }

    # 处理API请求
    location /api {
        proxy_pass http://your-backend-server;  # 替换为您的后端服务地址
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }

    error_page 404 /index.html;  # 将404错误重定向到首页
} 