nginx.conf 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. server {
  2. listen 80;
  3. server_name localhost;
  4. # Increase client body size limit for file uploads
  5. client_max_body_size 50M;
  6. # Serve Static Files
  7. location / {
  8. root /usr/share/nginx/html;
  9. index index.html index.htm;
  10. try_files $uri $uri/ /index.html;
  11. }
  12. # Proxy API requests to Backend
  13. location /api/ {
  14. proxy_pass http://backend:8000/api/;
  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. # WebSocket Support
  19. proxy_http_version 1.1;
  20. proxy_set_header Upgrade $http_upgrade;
  21. proxy_set_header Connection "upgrade";
  22. }
  23. }
  24. server {
  25. listen 443 ssl;
  26. server_name localhost;
  27. ssl_certificate /etc/nginx/certs/server.crt;
  28. ssl_certificate_key /etc/nginx/certs/server.key;
  29. # SSL Settings
  30. ssl_session_timeout 1d;
  31. ssl_session_cache shared:SSL:50m;
  32. ssl_session_tickets off;
  33. ssl_protocols TLSv1.2 TLSv1.3;
  34. ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
  35. ssl_prefer_server_ciphers off;
  36. # Increase client body size limit for file uploads
  37. client_max_body_size 50M;
  38. # Serve Static Files
  39. location / {
  40. root /usr/share/nginx/html;
  41. index index.html index.htm;
  42. try_files $uri $uri/ /index.html;
  43. }
  44. # Proxy API requests to Backend
  45. location /api/ {
  46. proxy_pass http://backend:8000/api/;
  47. proxy_set_header Host $host;
  48. proxy_set_header X-Real-IP $remote_addr;
  49. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  50. # WebSocket Support
  51. proxy_http_version 1.1;
  52. proxy_set_header Upgrade $http_upgrade;
  53. proxy_set_header Connection "upgrade";
  54. }
  55. }