nginx-configmap.yaml 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. apiVersion: v1
  2. kind: ConfigMap
  3. metadata:
  4. name: "nginx-configuration"
  5. data:
  6. protocol: {{ include "nginx.scheme" . }}
  7. {{ $timeout := 60 }}
  8. {{ $size := .Values.nextcloud.max_upload_size | default 3 }}
  9. {{/* Safely access key as it is conditionaly shown */}}
  10. {{ if hasKey .Values "nginxConfig" }}
  11. {{ $timeout = .Values.nginxConfig.proxy_timeouts | default 60 }}
  12. {{ end }}
  13. nginx.conf: |-
  14. events {}
  15. http {
  16. # redirects all http requests to https requests
  17. server {
  18. listen 8000 default_server;
  19. listen [::]:8000 default_server;
  20. return 301 https://$host$request_uri;
  21. }
  22. server {
  23. server_name localhost;
  24. listen {{ .Values.service.nodePort }} ssl http2;
  25. listen [::]:{{ .Values.service.nodePort }} ssl http2;
  26. ssl_certificate '/etc/nginx-certs/public.crt';
  27. ssl_certificate_key '/etc/nginx-certs/private.key';
  28. # maximum 3GB Upload File; change to fit your needs
  29. client_max_body_size {{ $size }}G;
  30. add_header Strict-Transport-Security "max-age=15552000; includeSubDomains; preload" always;
  31. location = /robots.txt {
  32. allow all;
  33. log_not_found off;
  34. access_log off;
  35. }
  36. location = /.well-known/carddav {
  37. return 301 $scheme://$host:$server_port/remote.php/dav;
  38. }
  39. location = /.well-known/caldav {
  40. return 301 $scheme://$host:$server_port/remote.php/dav;
  41. }
  42. location / {
  43. proxy_pass http://localhost;
  44. proxy_http_version 1.1;
  45. proxy_cache_bypass $http_upgrade;
  46. proxy_request_buffering off;
  47. # Proxy headers
  48. proxy_set_header Upgrade $http_upgrade;
  49. proxy_set_header Connection "upgrade";
  50. proxy_set_header Host $http_host;
  51. proxy_set_header X-Real-IP $remote_addr;
  52. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  53. proxy_set_header X-Forwarded-Proto https;
  54. proxy_set_header X-Forwarded-Host $host;
  55. proxy_set_header X-Forwarded-Port $server_port;
  56. # Proxy timeouts
  57. proxy_connect_timeout {{ $timeout }}s;
  58. proxy_send_timeout {{ $timeout }}s;
  59. proxy_read_timeout {{ $timeout }}s;
  60. }
  61. }
  62. }