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.
 
 

96 rivejä
3.0 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. {% if matrix_nginx_proxy_hsts_preload_enabled %}
  10. add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
  11. {% else %}
  12. add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
  13. {% endif %}
  14. add_header X-XSS-Protection "{{ matrix_nginx_proxy_xss_protection }}";
  15. {% for configuration_block in matrix_nginx_proxy_proxy_domain_additional_server_configuration_blocks %}
  16. {{- configuration_block }}
  17. {% endfor %}
  18. location /.well-known/matrix {
  19. root {{ matrix_static_files_base_path }};
  20. {#
  21. A somewhat long expires value is used to prevent outages
  22. in case this is unreachable due to network failure.
  23. #}
  24. expires 4h;
  25. default_type application/json;
  26. add_header Access-Control-Allow-Origin *;
  27. }
  28. {% endmacro %}
  29. server {
  30. listen {{ 8080 if matrix_nginx_proxy_enabled else 80 }};
  31. server_name {{ matrix_nginx_proxy_base_domain_hostname }};
  32. server_tokens off;
  33. {% if matrix_nginx_proxy_https_enabled %}
  34. location /.well-known/acme-challenge {
  35. {% if matrix_nginx_proxy_enabled %}
  36. {# Use the embedded DNS resolver in Docker containers to discover the service #}
  37. resolver 127.0.0.11 valid=5s;
  38. set $backend "matrix-certbot:8080";
  39. proxy_pass http://$backend;
  40. {% else %}
  41. {# Generic configuration for use outside of our container setup #}
  42. proxy_pass http://127.0.0.1:{{ matrix_ssl_lets_encrypt_certbot_standalone_http_port }};
  43. {% endif %}
  44. }
  45. location / {
  46. return 301 https://$http_host$request_uri;
  47. }
  48. {% else %}
  49. {{ render_vhost_directives() }}
  50. {% endif %}
  51. }
  52. {% if matrix_nginx_proxy_https_enabled %}
  53. server {
  54. listen {{ 8443 if matrix_nginx_proxy_enabled else 443 }} ssl http2;
  55. listen [::]:{{ 8443 if matrix_nginx_proxy_enabled else 443 }} ssl http2;
  56. server_name {{ matrix_nginx_proxy_base_domain_hostname }};
  57. server_tokens off;
  58. ssl_certificate {{ matrix_ssl_config_dir_path }}/live/{{ matrix_nginx_proxy_base_domain_hostname }}/fullchain.pem;
  59. ssl_certificate_key {{ matrix_ssl_config_dir_path }}/live/{{ matrix_nginx_proxy_base_domain_hostname }}/privkey.pem;
  60. ssl_protocols {{ matrix_nginx_proxy_ssl_protocols }};
  61. {% if matrix_nginx_proxy_ssl_ciphers != '' %}
  62. ssl_ciphers {{ matrix_nginx_proxy_ssl_ciphers }};
  63. {% endif %}
  64. ssl_prefer_server_ciphers {{ matrix_nginx_proxy_ssl_prefer_server_ciphers }};
  65. {% if matrix_nginx_proxy_ocsp_stapling_enabled %}
  66. ssl_stapling on;
  67. ssl_stapling_verify on;
  68. ssl_trusted_certificate {{ matrix_ssl_config_dir_path }}/live/{{ matrix_nginx_proxy_base_domain_hostname }}/chain.pem;
  69. {% endif %}
  70. {% if matrix_nginx_proxy_ssl_session_tickets_off %}
  71. ssl_session_tickets off;
  72. {% endif %}
  73. ssl_session_cache {{ matrix_nginx_proxy_ssl_session_cache }};
  74. ssl_session_timeout {{ matrix_nginx_proxy_ssl_session_timeout }};
  75. {{ render_vhost_directives() }}
  76. }
  77. {% endif %}