nginx.conf 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. # Proxy OIDC (Hydra public) with /hydra prefix
  24. location /hydra/ {
  25. # Strip /hydra prefix before forwarding to Hydra
  26. rewrite ^/hydra/(.*)$ /$1 break;
  27. proxy_pass http://hydra:4444;
  28. proxy_http_version 1.1;
  29. proxy_set_header Host $host;
  30. proxy_set_header X-Real-IP $remote_addr;
  31. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  32. proxy_set_header X-Forwarded-Proto $scheme;
  33. }
  34. }
  35. server {
  36. listen 443 ssl;
  37. server_name localhost;
  38. ssl_certificate /etc/nginx/certs/server.crt;
  39. ssl_certificate_key /etc/nginx/certs/server.key;
  40. # SSL Settings
  41. ssl_session_timeout 1d;
  42. ssl_session_cache shared:SSL:50m;
  43. ssl_session_tickets off;
  44. ssl_protocols TLSv1.2 TLSv1.3;
  45. 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;
  46. ssl_prefer_server_ciphers off;
  47. # Increase client body size limit for file uploads
  48. client_max_body_size 50M;
  49. # Serve Static Files
  50. location / {
  51. root /usr/share/nginx/html;
  52. index index.html index.htm;
  53. try_files $uri $uri/ /index.html;
  54. }
  55. # Proxy API requests to Backend
  56. location /api/ {
  57. proxy_pass http://backend:8000/api/;
  58. proxy_set_header Host $host;
  59. proxy_set_header X-Real-IP $remote_addr;
  60. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  61. # WebSocket Support
  62. proxy_http_version 1.1;
  63. proxy_set_header Upgrade $http_upgrade;
  64. proxy_set_header Connection "upgrade";
  65. }
  66. # Proxy OIDC (Hydra public) with /hydra prefix over HTTPS
  67. location /hydra/ {
  68. # Strip /hydra prefix before forwarding to Hydra
  69. rewrite ^/hydra/(.*)$ /$1 break;
  70. proxy_pass http://hydra:4444;
  71. proxy_http_version 1.1;
  72. proxy_set_header Host $host;
  73. proxy_set_header X-Real-IP $remote_addr;
  74. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  75. proxy_set_header X-Forwarded-Proto $scheme;
  76. }
  77. }