meet.conf 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. {{ $ENABLE_COLIBRI_WEBSOCKET := .Env.ENABLE_COLIBRI_WEBSOCKET | default "1" | toBool }}
  2. {{ $ENABLE_JAAS_COMPONENTS := .Env.ENABLE_JAAS_COMPONENTS | default "0" | toBool }}
  3. {{ $ENABLE_OCTO := .Env.ENABLE_OCTO | default "0" | toBool -}}
  4. {{ $ENABLE_XMPP_WEBSOCKET := .Env.ENABLE_XMPP_WEBSOCKET | default "1" | toBool }}
  5. {{ $ENABLE_SUBDOMAINS := .Env.ENABLE_SUBDOMAINS | default "true" | toBool -}}
  6. {{ $XMPP_DOMAIN := .Env.XMPP_DOMAIN | default "meet.jitsi" -}}
  7. {{ $XMPP_BOSH_URL_BASE := .Env.XMPP_BOSH_URL_BASE | default "http://xmpp.meet.jitsi:5280" -}}
  8. server_name _;
  9. client_max_body_size 0;
  10. root /usr/share/jitsi-meet;
  11. # ssi on with javascript for multidomain variables in config.js
  12. ssi on;
  13. ssi_types application/x-javascript application/javascript;
  14. index index.html index.htm;
  15. error_page 404 /static/404.html;
  16. # Security headers
  17. add_header X-Content-Type-Options nosniff;
  18. add_header X-XSS-Protection "1; mode=block";
  19. set $prefix "";
  20. {{ if .Env.DEPLOYMENTINFO_SHARD }}
  21. add_header X-Jitsi-Shard {{ .Env.DEPLOYMENTINFO_SHARD }};
  22. {{ end }}
  23. # Opt out of FLoC (deprecated)
  24. add_header Permissions-Policy "interest-cohort=()";
  25. location = /config.js {
  26. alias /config/config.js;
  27. }
  28. location = /interface_config.js {
  29. alias /config/interface_config.js;
  30. }
  31. location = /external_api.js {
  32. alias /usr/share/jitsi-meet/libs/external_api.min.js;
  33. }
  34. {{ if $ENABLE_JAAS_COMPONENTS }}
  35. location = /_api/room-info {
  36. proxy_pass {{ $XMPP_BOSH_URL_BASE }}/room-info?prefix=$prefix&$args;
  37. proxy_http_version 1.1;
  38. proxy_set_header X-Forwarded-For $remote_addr;
  39. proxy_set_header Host $http_host;
  40. }
  41. {{ end }}
  42. # ensure all static content can always be found first
  43. location ~ ^/(libs|css|static|images|fonts|lang|sounds|connection_optimization|.well-known)/(.*)$ {
  44. add_header 'Access-Control-Allow-Origin' '*';
  45. alias /usr/share/jitsi-meet/$1/$2;
  46. # cache all versioned files
  47. if ($arg_v) {
  48. expires 1y;
  49. }
  50. }
  51. {{ if $ENABLE_COLIBRI_WEBSOCKET }}
  52. # colibri (JVB) websockets
  53. location ~ ^/colibri-ws/([a-zA-Z0-9-\._]+)/(.*) {
  54. tcp_nodelay on;
  55. proxy_http_version 1.1;
  56. proxy_set_header Upgrade $http_upgrade;
  57. proxy_set_header Connection $connection_upgrade;
  58. proxy_pass http://$1:9090/colibri-ws/$1/$2$is_args$args;
  59. }
  60. {{ if $ENABLE_OCTO }}
  61. # colibri (JVB) Relay to Relay websockets
  62. location ~ ^/colibri-relay-ws/([a-zA-Z0-9-\._]+)/(.*) {
  63. tcp_nodelay on;
  64. proxy_http_version 1.1;
  65. proxy_set_header Upgrade $http_upgrade;
  66. proxy_set_header Connection $connection_upgrade;
  67. proxy_pass http://$1:9090/colibri-relay-ws/$1/$2$is_args$args;
  68. }
  69. {{ end }}
  70. {{ end }}
  71. # BOSH
  72. location = /http-bind {
  73. proxy_set_header X-Forwarded-For $remote_addr;
  74. proxy_set_header Host {{ $XMPP_DOMAIN }};
  75. proxy_pass {{ $XMPP_BOSH_URL_BASE }}/http-bind?prefix=$prefix&$args;
  76. }
  77. {{ if $ENABLE_XMPP_WEBSOCKET }}
  78. # xmpp websockets
  79. location = /xmpp-websocket {
  80. tcp_nodelay on;
  81. proxy_http_version 1.1;
  82. proxy_set_header Connection $connection_upgrade;
  83. proxy_set_header Upgrade $http_upgrade;
  84. proxy_set_header Host {{ $XMPP_DOMAIN }};
  85. proxy_set_header X-Forwarded-For $remote_addr;
  86. proxy_pass {{ $XMPP_BOSH_URL_BASE }}/xmpp-websocket?prefix=$prefix&$args;
  87. }
  88. {{ end }}
  89. {{ if .Env.ETHERPAD_URL_BASE }}
  90. # Etherpad-lite
  91. location ^~ /etherpad/ {
  92. proxy_buffering off;
  93. proxy_cache_bypass $http_upgrade;
  94. proxy_http_version 1.1;
  95. proxy_set_header Upgrade $http_upgrade;
  96. proxy_set_header Connection "upgrade";
  97. proxy_set_header X-Forwarded-For $remote_addr;
  98. proxy_pass {{ .Env.ETHERPAD_URL_BASE }}/;
  99. }
  100. {{ end }}
  101. location ~ ^/([^/?&:'"]+)$ {
  102. try_files $uri @root_path;
  103. }
  104. location @root_path {
  105. rewrite ^/(.*)$ / break;
  106. }
  107. {{ if $ENABLE_SUBDOMAINS }}
  108. location ~ ^/([^/?&:'"]+)/config.js$ {
  109. set $subdomain "$1.";
  110. set $subdir "$1/";
  111. alias /config/config.js;
  112. }
  113. # BOSH for subdomains
  114. location ~ ^/([^/?&:'"]+)/http-bind {
  115. set $subdomain "$1.";
  116. set $subdir "$1/";
  117. set $prefix "$1";
  118. rewrite ^/(.*)$ /http-bind;
  119. }
  120. {{ if $ENABLE_XMPP_WEBSOCKET }}
  121. # websockets for subdomains
  122. location ~ ^/([^/?&:'"]+)/xmpp-websocket {
  123. set $subdomain "$1.";
  124. set $subdir "$1/";
  125. set $prefix "$1";
  126. rewrite ^/(.*)$ /xmpp-websocket;
  127. }
  128. {{ end }}
  129. {{ if $ENABLE_JAAS_COMPONENTS }}
  130. location ~ ^/([^/?&:'"]+)/_api/room-info {
  131. set $subdomain "$1.";
  132. set $subdir "$1/";
  133. set $prefix "$1";
  134. rewrite ^/(.*)$ /_api/room-info;
  135. }
  136. {{ end }}
  137. # Anything that didn't match above, and isn't a real file, assume it's a room name and redirect to /
  138. location ~ ^/([^/?&:'"]+)/(.*)$ {
  139. set $subdomain "$1.";
  140. set $subdir "$1/";
  141. rewrite ^/([^/?&:'"]+)/(.*)$ /$2;
  142. }
  143. {{ end }}