nginx-config.conf 851 B

12345678910111213141516171819202122232425262728293031
  1. server {
  2. listen 80;
  3. server_name 192.168.1.17 localhost;
  4. # 前端静态文件
  5. location / {
  6. root /home/yangfei/mqtt-vue-dashboard/frontend/dist;
  7. index index.html;
  8. try_files $uri $uri/ /index.html;
  9. }
  10. # 后端API代理
  11. location /api {
  12. proxy_pass http://localhost:3002;
  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_cache_bypass $http_upgrade;
  18. }
  19. # WebSocket代理
  20. location /socket.io {
  21. proxy_pass http://localhost:3002;
  22. proxy_http_version 1.1;
  23. proxy_set_header Upgrade $http_upgrade;
  24. proxy_set_header Connection upgrade;
  25. proxy_set_header Host $host;
  26. proxy_cache_bypass $http_upgrade;
  27. }
  28. }