nginx.conf 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. # PCB AFM Simulation System - Nginx Configuration
  2. server {
  3. listen 80;
  4. server_name localhost;
  5. root /usr/share/nginx/html;
  6. index index.html;
  7. # Gzip compression
  8. gzip on;
  9. gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
  10. gzip_min_length 1024;
  11. # API proxy to backend
  12. location /api/ {
  13. proxy_pass http://backend:8000;
  14. proxy_set_header Host $host;
  15. proxy_set_header X-Real-IP $remote_addr;
  16. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  17. proxy_set_header X-Forwarded-Proto $scheme;
  18. proxy_read_timeout 300s;
  19. proxy_connect_timeout 10s;
  20. }
  21. # WebSocket proxy
  22. location /ws/ {
  23. proxy_pass http://backend:8000;
  24. proxy_http_version 1.1;
  25. proxy_set_header Upgrade $http_upgrade;
  26. proxy_set_header Connection "upgrade";
  27. proxy_set_header Host $host;
  28. proxy_read_timeout 86400s;
  29. }
  30. # SPA routing - fallback to index.html
  31. location / {
  32. try_files $uri $uri/ /index.html;
  33. }
  34. # Cache static assets
  35. location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
  36. expires 1y;
  37. add_header Cache-Control "public, immutable";
  38. }
  39. }