nginx.conf 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. worker_processes 1;
  2. events {
  3. worker_connections 1024;
  4. }
  5. http {
  6. include mime.types;
  7. default_type application/octet-stream;
  8. sendfile on;
  9. keepalive_timeout 65;
  10. server {
  11. listen 80;
  12. listen [::]:80;
  13. server_name _;
  14. resolver 127.0.0.11; # Specific to running nginx proxy in docker
  15. # See https://github.com/docker/compose/issues/3412
  16. # Redirect all HTTP requests to HTTPS
  17. return 301 https://$host$request_uri;
  18. }
  19. server {
  20. listen 443 ssl;
  21. listen [::]:443 ssl;
  22. http2 on;
  23. server_name _;
  24. resolver 127.0.0.11; # Specific to running nginx proxy in docker
  25. # See https://github.com/docker/compose/issues/3412
  26. # SSL configuration
  27. ssl_certificate /certs/localhost.crt;
  28. ssl_certificate_key /certs/localhost.key;
  29. ssl_session_timeout 1d;
  30. # Proxy pass to app:8080
  31. location / {
  32. proxy_pass http://app:8080;
  33. proxy_redirect http://app:8080/ /;
  34. proxy_set_header Host $host;
  35. proxy_set_header X-Real-IP $remote_addr;
  36. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  37. proxy_set_header X-Forwarded-Proto $scheme;
  38. proxy_http_version 1.1;
  39. proxy_set_header Upgrade $http_upgrade;
  40. proxy_set_header Connection "Upgrade";
  41. }
  42. }
  43. }