nginx-conf.yaml 3.9 KB

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