nginx.conf 1.8 KB

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