nginx.conf 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. server {
  2. server_name radionica3d.me 148.230.71.134;
  3. root /var/www/radionica3d/dist;
  4. index index.html;
  5. # Gzip Compression
  6. gzip on;
  7. gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
  8. location / {
  9. try_files $uri $uri/ /index.html;
  10. }
  11. # Proxy API requests to backend
  12. location /api/ {
  13. proxy_pass http://localhost:8000/;
  14. proxy_set_header Host $host;
  15. proxy_set_header X-Real-IP $remote_addr;
  16. }
  17. # Standalone Deploy Webhook
  18. location /deploy-webhook {
  19. proxy_pass http://127.0.0.1:9000;
  20. proxy_set_header Host $host;
  21. }
  22. # WebSocket requests
  23. location /ws/ {
  24. proxy_pass http://localhost:8000/;
  25. proxy_http_version 1.1;
  26. proxy_set_header Upgrade $http_upgrade;
  27. proxy_set_header Connection "Upgrade";
  28. proxy_set_header Host $host;
  29. }
  30. # Static uploads
  31. location /uploads/ {
  32. alias /var/www/radionica3d/backend/uploads/;
  33. expires 7d;
  34. add_header Cache-Control "public";
  35. }
  36. listen 443 ssl; # managed by Certbot
  37. ssl_certificate /etc/letsencrypt/live/radionica3d.me/fullchain.pem; # managed by Certbot
  38. ssl_certificate_key /etc/letsencrypt/live/radionica3d.me/privkey.pem; # managed by Certbot
  39. include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
  40. ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
  41. }
  42. server {
  43. if ($host = radionica3d.me) {
  44. return 301 https://$host$request_uri;
  45. } # managed by Certbot
  46. listen 80;
  47. server_name radionica3d.me;
  48. return 301 https://radionica3d.me$request_uri;
  49. }