Matrix Docker Ansible eploy
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

143 lines
4.7 KiB

  1. #jinja2: lstrip_blocks: "True"
  2. {% macro render_vhost_directives() %}
  3. gzip on;
  4. gzip_types text/plain application/json application/javascript text/css image/x-icon font/ttf image/gif;
  5. {% if matrix_nginx_proxy_hsts_preload_enabled %}
  6. add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
  7. {% else %}
  8. add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
  9. {% endif %}
  10. add_header X-XSS-Protection "{{ matrix_nginx_proxy_xss_protection }}";
  11. add_header X-Content-Type-Options nosniff;
  12. {% if matrix_nginx_proxy_floc_optout_enabled %}
  13. add_header Permissions-Policy interest-cohort=() always;
  14. {% endif %}
  15. {% for configuration_block in matrix_nginx_proxy_proxy_jitsi_additional_server_configuration_blocks %}
  16. {{- configuration_block }}
  17. {% endfor %}
  18. location / {
  19. {% if matrix_nginx_proxy_enabled %}
  20. {# Use the embedded DNS resolver in Docker containers to discover the service #}
  21. resolver 127.0.0.11 valid=5s;
  22. set $backend "matrix-jitsi-web:80";
  23. proxy_pass http://$backend;
  24. {% else %}
  25. {# Generic configuration for use outside of our container setup #}
  26. proxy_pass http://127.0.0.1:13080;
  27. {% endif %}
  28. proxy_set_header Host $host;
  29. proxy_set_header X-Forwarded-For {{ matrix_nginx_proxy_x_forwarded_for }};
  30. }
  31. # colibri (JVB) websockets
  32. location ~ ^/colibri-ws/([a-zA-Z0-9-\.]+)/(.*) {
  33. {% if matrix_nginx_proxy_enabled %}
  34. resolver 127.0.0.11 valid=5s;
  35. set $backend "matrix-jitsi-jvb:9090";
  36. proxy_pass http://$backend;
  37. {% else %}
  38. {# Generic configuration for use outside of our container setup #}
  39. proxy_pass http://127.0.0.1:13090;
  40. {% endif %}
  41. proxy_set_header Host $host;
  42. proxy_set_header X-Forwarded-For {{ matrix_nginx_proxy_x_forwarded_for }};
  43. proxy_set_header Upgrade $http_upgrade;
  44. proxy_set_header Connection "upgrade";
  45. proxy_http_version 1.1;
  46. tcp_nodelay on;
  47. }
  48. # XMPP websocket
  49. location = /xmpp-websocket {
  50. {% if matrix_nginx_proxy_enabled %}
  51. resolver 127.0.0.11 valid=5s;
  52. set $backend {{ matrix_jitsi_xmpp_bosh_url_base }};
  53. proxy_pass $backend/xmpp-websocket;
  54. {% else %}
  55. {# Generic configuration for use outside of our container setup #}
  56. proxy_pass http://127.0.0.1:5280;
  57. {% endif %}
  58. proxy_set_header Host $host;
  59. proxy_http_version 1.1;
  60. proxy_read_timeout 900s;
  61. proxy_set_header Connection "upgrade";
  62. proxy_set_header Upgrade $http_upgrade;
  63. proxy_set_header X-Forwarded-For {{ matrix_nginx_proxy_x_forwarded_for }};
  64. proxy_set_header X-Forwarded-Proto {{ matrix_nginx_proxy_x_forwarded_proto_value }};
  65. tcp_nodelay on;
  66. }
  67. {% endmacro %}
  68. server {
  69. listen {{ 8080 if matrix_nginx_proxy_enabled else 80 }};
  70. listen [::]:{{ 8080 if matrix_nginx_proxy_enabled else 80 }};
  71. server_name {{ matrix_nginx_proxy_proxy_jitsi_hostname }};
  72. server_tokens off;
  73. root /dev/null;
  74. {% if matrix_nginx_proxy_https_enabled %}
  75. location /.well-known/acme-challenge {
  76. {% if matrix_nginx_proxy_enabled %}
  77. {# Use the embedded DNS resolver in Docker containers to discover the service #}
  78. resolver 127.0.0.11 valid=5s;
  79. set $backend "matrix-certbot:8080";
  80. proxy_pass http://$backend;
  81. {% else %}
  82. {# Generic configuration for use outside of our container setup #}
  83. proxy_pass http://127.0.0.1:{{ matrix_ssl_lets_encrypt_certbot_standalone_http_port }};
  84. {% endif %}
  85. }
  86. location / {
  87. return 301 https://$http_host$request_uri;
  88. }
  89. {% else %}
  90. {{ render_vhost_directives() }}
  91. {% endif %}
  92. }
  93. {% if matrix_nginx_proxy_https_enabled %}
  94. server {
  95. listen {{ 8443 if matrix_nginx_proxy_enabled else 443 }} ssl http2;
  96. listen [::]:{{ 8443 if matrix_nginx_proxy_enabled else 443 }} ssl http2;
  97. server_name {{ matrix_nginx_proxy_proxy_jitsi_hostname }};
  98. server_tokens off;
  99. root /dev/null;
  100. ssl_certificate {{ matrix_ssl_config_dir_path }}/live/{{ matrix_nginx_proxy_proxy_jitsi_hostname }}/fullchain.pem;
  101. ssl_certificate_key {{ matrix_ssl_config_dir_path }}/live/{{ matrix_nginx_proxy_proxy_jitsi_hostname }}/privkey.pem;
  102. ssl_protocols {{ matrix_nginx_proxy_ssl_protocols }};
  103. {% if matrix_nginx_proxy_ssl_ciphers != '' %}
  104. ssl_ciphers {{ matrix_nginx_proxy_ssl_ciphers }};
  105. {% endif %}
  106. ssl_prefer_server_ciphers {{ matrix_nginx_proxy_ssl_prefer_server_ciphers }};
  107. {% if matrix_nginx_proxy_ocsp_stapling_enabled %}
  108. ssl_stapling on;
  109. ssl_stapling_verify on;
  110. ssl_trusted_certificate {{ matrix_ssl_config_dir_path }}/live/{{ matrix_nginx_proxy_proxy_jitsi_hostname }}/chain.pem;
  111. {% endif %}
  112. {% if matrix_nginx_proxy_ssl_session_tickets_off %}
  113. ssl_session_tickets off;
  114. {% endif %}
  115. ssl_session_cache {{ matrix_nginx_proxy_ssl_session_cache }};
  116. ssl_session_timeout {{ matrix_nginx_proxy_ssl_session_timeout }};
  117. {{ render_vhost_directives() }}
  118. }
  119. {% endif %}