nginx.conf 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. server {
  2. listen 80;
  3. server_name _;
  4. # Increase max upload size for pattern files
  5. client_max_body_size 10M;
  6. # Frontend - serve static files
  7. location / {
  8. root /usr/share/nginx/html;
  9. index index.html;
  10. try_files $uri $uri/ /index.html;
  11. }
  12. # API proxy to backend container
  13. location /api/ {
  14. proxy_pass http://127.0.0.1:8080;
  15. proxy_set_header Host $host;
  16. proxy_set_header X-Real-IP $remote_addr;
  17. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  18. proxy_set_header X-Forwarded-Proto $scheme;
  19. }
  20. # WebSocket proxy
  21. location /ws/ {
  22. proxy_pass http://127.0.0.1:8080;
  23. proxy_http_version 1.1;
  24. proxy_set_header Upgrade $http_upgrade;
  25. proxy_set_header Connection "upgrade";
  26. proxy_set_header Host $host;
  27. proxy_set_header X-Real-IP $remote_addr;
  28. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  29. proxy_read_timeout 86400;
  30. }
  31. # Static files from backend (pattern previews, custom logos)
  32. location /static/ {
  33. proxy_pass http://127.0.0.1:8080;
  34. proxy_set_header Host $host;
  35. proxy_set_header X-Real-IP $remote_addr;
  36. proxy_cache_valid 200 1h;
  37. }
  38. # All backend API endpoints (legacy non-/api/ routes)
  39. location ~ ^/(list_theta_rho_files|preview_thr_batch|get_theta_rho_coordinates|upload_theta_rho|pause_execution|resume_execution|stop_execution|force_stop|soft_reset|skip_pattern|set_speed|get_speed|restart|shutdown|run_pattern|run_playlist|connect_device|disconnect_device|home_device|clear_sand|move_to_position|get_playlists|save_playlist|delete_playlist|rename_playlist|reorder_playlist|delete_theta_rho_file|get_status|list_serial_ports|serial_status|cache-progress|rebuild_cache|get_led_config|set_led_config|get_wled_ip|set_wled_ip|led|send_home|send_coordinate|move_to_center|move_to_perimeter|run_theta_rho|connect|disconnect|list_theta_rho_files_with_metadata|list_all_playlists|get_playlist|create_playlist|modify_playlist|add_to_playlist|preview_thr|preview|add_to_queue|restart_connection|controller_restart|recover_sensor_homing|run_theta_rho_file|download|check_software_update|update_software) {
  40. proxy_pass http://127.0.0.1:8080;
  41. proxy_set_header Host $host;
  42. proxy_set_header X-Real-IP $remote_addr;
  43. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  44. proxy_set_header X-Forwarded-Proto $scheme;
  45. }
  46. }