server {
    listen 80;
    server_name jarvis.van333.cn;
    
    # 设置根目录
    root /www/sites/jarvis.van333.cn/index;
    index index.html index.htm;
    
    # 代理头设置
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Host $server_name;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $http_connection;
    
    # 日志配置
    access_log /www/sites/jarvis.van333.cn/log/access.log main;
    error_log /www/sites/jarvis.van333.cn/log/error.log;
    
    # SSL证书验证
    location ^~ /.well-known/acme-challenge {
        allow all;
        root /usr/share/nginx/html;
    }
    
    # 静态资源处理
    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;
    }
    
    # API代理 - 如果有后端API
    location /api/ {
        proxy_pass http://localhost:8080/;  # 根据您的后端服务地址调整
        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;
    }
    
    # 处理Vue Router的History模式
    location / {
        try_files $uri $uri/ /index.html;
    }
    
    # 404错误页面
    error_page 404 /404.html;
} 