Matrix Docker Ansible eploy
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

97 строки
3.3 KiB

  1. #jinja2: lstrip_blocks: "True"
  2. {% macro render_vhost_directives() %}
  3. root {{ matrix_nginx_proxy_data_path_in_container if matrix_nginx_proxy_enabled else matrix_nginx_proxy_data_path }}{{ matrix_nginx_proxy_data_path_extension }};
  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. listen [::]:{{ 8080 if matrix_nginx_proxy_enabled else 80 }};
  32. server_name {{ matrix_nginx_proxy_base_domain_hostname }};
  33. server_tokens off;
  34. {% if matrix_nginx_proxy_https_enabled %}
  35. location /.well-known/acme-challenge {
  36. {% if matrix_nginx_proxy_enabled %}
  37. {# Use the embedded DNS resolver in Docker containers to discover the service #}
  38. resolver {{ matrix_nginx_proxy_http_level_resolver }} valid=5s;
  39. set $backend "matrix-certbot:8080";
  40. proxy_pass http://$backend;
  41. {% else %}
  42. {# Generic configuration for use outside of our container setup #}
  43. proxy_pass http://127.0.0.1:{{ matrix_ssl_lets_encrypt_certbot_standalone_http_port }};
  44. {% endif %}
  45. }
  46. location / {
  47. return 301 https://$http_host$request_uri;
  48. }
  49. {% else %}
  50. {{ render_vhost_directives() }}
  51. {% endif %}
  52. }
  53. {% if matrix_nginx_proxy_https_enabled %}
  54. server {
  55. listen {{ 8443 if matrix_nginx_proxy_enabled else 443 }} ssl http2;
  56. listen [::]:{{ 8443 if matrix_nginx_proxy_enabled else 443 }} ssl http2;
  57. server_name {{ matrix_nginx_proxy_base_domain_hostname }};
  58. server_tokens off;
  59. ssl_certificate {{ matrix_ssl_config_dir_path }}/live/{{ matrix_nginx_proxy_base_domain_hostname }}/fullchain.pem;
  60. ssl_certificate_key {{ matrix_ssl_config_dir_path }}/live/{{ matrix_nginx_proxy_base_domain_hostname }}/privkey.pem;
  61. ssl_protocols {{ matrix_nginx_proxy_ssl_protocols }};
  62. {% if matrix_nginx_proxy_ssl_ciphers != '' %}
  63. ssl_ciphers {{ matrix_nginx_proxy_ssl_ciphers }};
  64. {% endif %}
  65. ssl_prefer_server_ciphers {{ matrix_nginx_proxy_ssl_prefer_server_ciphers }};
  66. {% if matrix_nginx_proxy_ocsp_stapling_enabled %}
  67. ssl_stapling on;
  68. ssl_stapling_verify on;
  69. ssl_trusted_certificate {{ matrix_ssl_config_dir_path }}/live/{{ matrix_nginx_proxy_base_domain_hostname }}/chain.pem;
  70. {% endif %}
  71. {% if matrix_nginx_proxy_ssl_session_tickets_off %}
  72. ssl_session_tickets off;
  73. {% endif %}
  74. ssl_session_cache {{ matrix_nginx_proxy_ssl_session_cache }};
  75. ssl_session_timeout {{ matrix_nginx_proxy_ssl_session_timeout }};
  76. {{ render_vhost_directives() }}
  77. }
  78. {% endif %}