default.conf 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. server {
  2. listen 80;
  3. server_name localhost;
  4. root /usr/share/nginx/html;
  5. index index.html index.htm;
  6. # Compression gzip
  7. gzip on;
  8. gzip_vary on;
  9. gzip_min_length 10240;
  10. gzip_proxied expired no-cache no-store private auth;
  11. gzip_types text/plain text/css text/xml text/javascript application/javascript application/x-javascript application/xml;
  12. # Cache des assets statiques
  13. location ~* \.(jpg|jpeg|png|gif|ico|css|js|svg)$ {
  14. expires 1y;
  15. add_header Cache-Control "public, max-age=31536000";
  16. }
  17. # Proxy les requêtes API vers le backend
  18. location /api/ {
  19. proxy_pass http://framed-server:3000/api/;
  20. proxy_http_version 1.1;
  21. proxy_set_header Upgrade $http_upgrade;
  22. proxy_set_header Connection 'upgrade';
  23. proxy_set_header Host $host;
  24. proxy_cache_bypass $http_upgrade;
  25. }
  26. # Servir le frontend React
  27. location / {
  28. try_files $uri $uri/ /index.html;
  29. }
  30. # Erreur 404
  31. error_page 404 /index.html;
  32. }