meet.conf 4.3 KB

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