server { listen 80; server_name 1.92.111.107; # 前端静态文件 location / { root /var/www/glucowise; index index.html; try_files $uri $uri/ /index.html; } # 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; # 超时设置 proxy_connect_timeout 30s; proxy_send_timeout 30s; proxy_read_timeout 30s; } # 上传文件访问 location /uploads/ { alias /opt/glucowise/uploads/; expires 1y; add_header Cache-Control "public"; } }