nginx-conf.yaml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. {{ if .Values.certificate }}
  2. {{- $serviceName := "localhost" -}}
  3. apiVersion: v1
  4. kind: ConfigMap
  5. metadata:
  6. name: "nginx-config"
  7. annotations:
  8. rollme: {{ randAlphaNum 5 | quote }}
  9. data:
  10. config: |-
  11. events {
  12. worker_connections 1024;
  13. }
  14. http {
  15. include mime.types;
  16. default_type application/octet-stream;
  17. # Types to enable gzip compression on
  18. gzip_types
  19. text/plain
  20. text/css
  21. text/js
  22. text/xml
  23. text/javascript
  24. application/javascript
  25. application/x-javascript
  26. application/json
  27. application/xml
  28. application/rss+xml
  29. image/svg+xml;
  30. sendfile on;
  31. client_max_body_size 1000m;
  32. keepalive_timeout 65;
  33. # Disable tokens for security (#23684)
  34. server_tokens off;
  35. gzip on;
  36. client_body_temp_path /var/tmp/firmware;
  37. server {
  38. server_name nginx;
  39. listen 0.0.0.0:443 default_server ssl http2;
  40. listen [::]:443 default_server ssl http2;
  41. ssl_certificate "/etc/nginx/server.crt";
  42. ssl_certificate_key "/etc/nginx/server.key";
  43. ssl_session_timeout 120m;
  44. ssl_session_cache shared:ssl:16m;
  45. ssl_protocols TLSv1.2 TLSv1.3;
  46. ssl_prefer_server_ciphers on;
  47. ssl_ciphers EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA:EDH+aRSA:EECDH:!RC4:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS:!SHA1:!SHA256:!SHA384;
  48. add_header Strict-Transport-Security max-age=31536000;
  49. location = /robots.txt {
  50. add_header Content-Type text/plain;
  51. proxy_set_header Referer "http://nginx";
  52. return 200 "User-agent: *\nDisallow: /loleaflet/*\n";
  53. }
  54. # static files
  55. location ^~ /browser {
  56. proxy_pass http://{{ $serviceName }}:9980;
  57. proxy_set_header Host $host;
  58. # proxy_set_header Referer "http://nginx";
  59. }
  60. # WOPI discovery URL
  61. location ^~ /hosting/discovery {
  62. set $upstream_collabora {{ $serviceName }};
  63. proxy_pass http://$upstream_collabora:9980;
  64. proxy_set_header Host $http_host;
  65. # proxy_set_header Referer "http://nginx";
  66. }
  67. # Capabilities
  68. location ^~ /hosting/capabilities {
  69. proxy_pass http://{{ $serviceName }}:9980;
  70. proxy_set_header Host $host;
  71. # proxy_set_header Referer "http://nginx";
  72. }
  73. # main websocket
  74. location ~ ^/cool/(.*)/ws$ {
  75. proxy_pass http://{{ $serviceName }}:9980;
  76. proxy_set_header Host $host;
  77. proxy_set_header Upgrade $http_upgrade;
  78. proxy_set_header Connection "Upgrade";
  79. # proxy_set_header Referer "http://nginx";
  80. proxy_read_timeout 36000s;
  81. }
  82. # download, presentation and image upload
  83. location ~ ^/(c|l)ool {
  84. proxy_pass http://{{ $serviceName }}:9980;
  85. proxy_set_header Host $host;
  86. proxy_set_header Referer "http://nginx";
  87. }
  88. # Admin Console websocket
  89. location ^~ /cool/adminws {
  90. proxy_pass http://{{ $serviceName }}:9980;
  91. proxy_set_header Host $host;
  92. proxy_set_header Upgrade $http_upgrade;
  93. proxy_set_header Connection "Upgrade";
  94. # proxy_set_header Referer "http://nginx";
  95. proxy_read_timeout 36000s;
  96. }
  97. }
  98. server {
  99. listen 0.0.0.0:80;
  100. listen [::]:80;
  101. server_name nginx;
  102. return 307 https://$host:{{ .Values.nodePort }}}$request_uri;
  103. }
  104. }
  105. {{ end }}