nginx.conf 646 B

123456789101112131415161718192021222324
  1. server {
  2. listen 80;
  3. server_name _;
  4. # 前端静态文件
  5. location / {
  6. root /usr/share/nginx/html;
  7. index index.html;
  8. try_files $uri $uri/ /index.html;
  9. }
  10. # API 代理(含 WebSocket)
  11. location /api/ {
  12. proxy_pass http://api:8080;
  13. proxy_http_version 1.1;
  14. proxy_set_header Upgrade $http_upgrade;
  15. proxy_set_header Connection "upgrade";
  16. proxy_set_header Host $host;
  17. proxy_set_header X-Real-IP $remote_addr;
  18. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  19. proxy_read_timeout 300s;
  20. proxy_send_timeout 300s;
  21. }
  22. }