dzxj_dtu.conf 824 B

12345678910111213141516171819202122232425262728293031
  1. server {
  2. listen 80;
  3. server_name localhost;
  4. # 前端静态文件目录
  5. root /var/www/html;
  6. index index.html;
  7. location / {
  8. try_files $uri $uri/ /index.html;
  9. }
  10. # 代理后端API请求
  11. location /api {
  12. proxy_pass http://localhost:5001/api;
  13. proxy_set_header Host $host;
  14. proxy_set_header X-Real-IP $remote_addr;
  15. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  16. proxy_set_header X-Forwarded-Proto $scheme;
  17. }
  18. # WebSocket连接代理
  19. location /socket.io {
  20. proxy_pass http://localhost:5001/socket.io;
  21. proxy_http_version 1.1;
  22. proxy_set_header Upgrade $http_upgrade;
  23. proxy_set_header Connection 'upgrade';
  24. proxy_set_header Host $host;
  25. proxy_cache_bypass $http_upgrade;
  26. }
  27. }