# lq_label 前端 Nginx 配置 # 将此文件复制到 Nginx 配置目录,或 include 到主配置中 server { listen 80; server_name localhost; # 修改为你的域名 # 前端静态文件目录 # 根据实际部署路径修改 root /path/to/lq_label/dist/apps/lq_label; index index.html; # Gzip 压缩 gzip on; gzip_types text/plain text/css application/json application/javascript text/xml application/xml; gzip_min_length 1000; # 静态资源缓存 location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ { expires 1y; add_header Cache-Control "public, immutable"; } # API 代理到后端 location /api/ { proxy_pass http://localhost:8002/; 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; } # SPA 路由支持 - 所有路由返回 index.html location / { try_files $uri $uri/ /index.html; } # 错误页面 error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } }