fluidd.conf 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. map $http_upgrade $connection_upgrade {
  2. default upgrade;
  3. '' close;
  4. }
  5. # moonraker
  6. upstream apiserver {
  7. ip_hash;
  8. server 127.0.0.1:7125;
  9. }
  10. server {
  11. listen 80 default_server;
  12. listen [::]:80 default_server;
  13. access_log /var/log/nginx/fluidd-access.log;
  14. error_log /var/log/nginx/fluidd-error.log;
  15. #disable this section on smaller hardware like a pi zero
  16. gzip on;
  17. gzip_vary on;
  18. gzip_proxied any;
  19. gzip_proxied expired no-cache no-store private auth;
  20. gzip_comp_level 4;
  21. gzip_buffers 16 8k;
  22. gzip_http_version 1.1;
  23. gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/json application/xml;
  24. #web_path from mainsail static files
  25. root /usr/share/webapps/fluidd;
  26. index index.html;
  27. server_name _;
  28. #disable max upload size
  29. client_max_body_size 0;
  30. location / {
  31. try_files $uri $uri/ /index.html;
  32. }
  33. location = /index.html {
  34. add_header Cache-Control "no-store, no-cache, must-revalidate";
  35. }
  36. location /websocket {
  37. proxy_pass http://apiserver/websocket;
  38. proxy_http_version 1.1;
  39. proxy_set_header Upgrade $http_upgrade;
  40. proxy_set_header Connection $connection_upgrade;
  41. proxy_set_header Host $http_host;
  42. proxy_set_header X-Real-IP $remote_addr;
  43. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  44. proxy_read_timeout 86400;
  45. }
  46. location ~ ^/(printer|api|access|machine|server)/ {
  47. proxy_pass http://apiserver$request_uri;
  48. proxy_set_header Host $http_host;
  49. proxy_set_header X-Real-IP $remote_addr;
  50. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  51. proxy_set_header X-Scheme $scheme;
  52. }
  53. }