meet.conf 4.3 KB

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