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.
 
 

88 rivejä
2.7 KiB

  1. #jinja2: lstrip_blocks: "True"
  2. {% macro render_vhost_directives() %}
  3. root /nginx-data/matrix-domain;
  4. gzip on;
  5. gzip_types text/plain application/json;
  6. {% if matrix_nginx_proxy_floc_optout_enabled %}
  7. add_header Permissions-Policy interest-cohort=() always;
  8. {% endif %}
  9. {% for configuration_block in matrix_nginx_proxy_proxy_domain_additional_server_configuration_blocks %}
  10. {{- configuration_block }}
  11. {% endfor %}
  12. location /.well-known/matrix {
  13. root {{ matrix_static_files_base_path }};
  14. {#
  15. A somewhat long expires value is used to prevent outages
  16. in case this is unreachable due to network failure.
  17. #}
  18. expires 4h;
  19. default_type application/json;
  20. add_header Access-Control-Allow-Origin *;
  21. }
  22. {% endmacro %}
  23. server {
  24. listen {{ 8080 if matrix_nginx_proxy_enabled else 80 }};
  25. server_name {{ matrix_nginx_proxy_base_domain_hostname }};
  26. server_tokens off;
  27. {% if matrix_nginx_proxy_https_enabled %}
  28. location /.well-known/acme-challenge {
  29. {% if matrix_nginx_proxy_enabled %}
  30. {# Use the embedded DNS resolver in Docker containers to discover the service #}
  31. resolver 127.0.0.11 valid=5s;
  32. set $backend "matrix-certbot:8080";
  33. proxy_pass http://$backend;
  34. {% else %}
  35. {# Generic configuration for use outside of our container setup #}
  36. proxy_pass http://127.0.0.1:{{ matrix_ssl_lets_encrypt_certbot_standalone_http_port }};
  37. {% endif %}
  38. }
  39. location / {
  40. return 301 https://$http_host$request_uri;
  41. }
  42. {% else %}
  43. {{ render_vhost_directives() }}
  44. {% endif %}
  45. }
  46. {% if matrix_nginx_proxy_https_enabled %}
  47. server {
  48. listen {{ 8443 if matrix_nginx_proxy_enabled else 443 }} ssl http2;
  49. listen [::]:{{ 8443 if matrix_nginx_proxy_enabled else 443 }} ssl http2;
  50. server_name {{ matrix_nginx_proxy_base_domain_hostname }};
  51. server_tokens off;
  52. ssl_certificate {{ matrix_ssl_config_dir_path }}/live/{{ matrix_nginx_proxy_base_domain_hostname }}/fullchain.pem;
  53. ssl_certificate_key {{ matrix_ssl_config_dir_path }}/live/{{ matrix_nginx_proxy_base_domain_hostname }}/privkey.pem;
  54. ssl_protocols {{ matrix_nginx_proxy_ssl_protocols }};
  55. {% if matrix_nginx_proxy_ssl_ciphers != '' %}
  56. ssl_ciphers {{ matrix_nginx_proxy_ssl_ciphers }};
  57. {% endif %}
  58. ssl_prefer_server_ciphers {{ matrix_nginx_proxy_ssl_prefer_server_ciphers }};
  59. {% if matrix_nginx_proxy_ocsp_stapling_enabled %}
  60. ssl_stapling on;
  61. ssl_stapling_verify on;
  62. ssl_trusted_certificate {{ matrix_ssl_config_dir_path }}/live/{{ matrix_nginx_proxy_base_domain_hostname }}/chain.pem;
  63. {% endif %}
  64. {% if matrix_nginx_proxy_ssl_session_tickets_off %}
  65. ssl_session_tickets off;
  66. {% endif %}
  67. ssl_session_cache {{ matrix_nginx_proxy_ssl_session_cache }};
  68. ssl_session_timeout {{ matrix_nginx_proxy_ssl_session_timeout }};
  69. {{ render_vhost_directives() }}
  70. }
  71. {% endif %}