meet.conf 4.9 KB

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