Matrix Docker Ansible eploy
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 

105 wiersze
3.4 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-Content-Type-Options nosniff;
  11. add_header X-XSS-Protection "{{ matrix_nginx_proxy_xss_protection }}";
  12. add_header X-Frame-Options SAMEORIGIN;
  13. add_header Content-Security-Policy "frame-ancestors 'self'";
  14. {% if matrix_nginx_proxy_floc_optout_enabled %}
  15. add_header Permissions-Policy interest-cohort=() always;
  16. {% endif %}
  17. {% for configuration_block in matrix_nginx_proxy_proxy_element_additional_server_configuration_blocks %}
  18. {{- configuration_block }}
  19. {% endfor %}
  20. location / {
  21. {% if matrix_nginx_proxy_enabled %}
  22. {# Use the embedded DNS resolver in Docker containers to discover the service #}
  23. resolver 127.0.0.11 valid=5s;
  24. set $backend "matrix-client-element:8080";
  25. proxy_pass http://$backend;
  26. {% else %}
  27. {# Generic configuration for use outside of our container setup #}
  28. proxy_pass http://127.0.0.1:8765;
  29. {% endif %}
  30. proxy_set_header Host $host;
  31. proxy_set_header X-Forwarded-For $remote_addr;
  32. }
  33. {% endmacro %}
  34. server {
  35. listen {{ 8080 if matrix_nginx_proxy_enabled else 80 }};
  36. server_name {{ matrix_nginx_proxy_proxy_element_hostname }};
  37. server_tokens off;
  38. root /dev/null;
  39. {% if matrix_nginx_proxy_https_enabled %}
  40. location /.well-known/acme-challenge {
  41. {% if matrix_nginx_proxy_enabled %}
  42. {# Use the embedded DNS resolver in Docker containers to discover the service #}
  43. resolver 127.0.0.11 valid=5s;
  44. set $backend "matrix-certbot:8080";
  45. proxy_pass http://$backend;
  46. {% else %}
  47. {# Generic configuration for use outside of our container setup #}
  48. proxy_pass http://127.0.0.1:{{ matrix_ssl_lets_encrypt_certbot_standalone_http_port }};
  49. {% endif %}
  50. }
  51. location / {
  52. return 301 https://$http_host$request_uri;
  53. }
  54. {% else %}
  55. {{ render_vhost_directives() }}
  56. {% endif %}
  57. }
  58. {% if matrix_nginx_proxy_https_enabled %}
  59. server {
  60. listen {{ 8443 if matrix_nginx_proxy_enabled else 443 }} ssl http2;
  61. listen [::]:{{ 8443 if matrix_nginx_proxy_enabled else 443 }} ssl http2;
  62. server_name {{ matrix_nginx_proxy_proxy_element_hostname }};
  63. server_tokens off;
  64. root /dev/null;
  65. ssl_certificate {{ matrix_ssl_config_dir_path }}/live/{{ matrix_nginx_proxy_proxy_element_hostname }}/fullchain.pem;
  66. ssl_certificate_key {{ matrix_ssl_config_dir_path }}/live/{{ matrix_nginx_proxy_proxy_element_hostname }}/privkey.pem;
  67. ssl_protocols {{ matrix_nginx_proxy_ssl_protocols }};
  68. {% if matrix_nginx_proxy_ssl_ciphers != "" %}
  69. ssl_ciphers {{ matrix_nginx_proxy_ssl_ciphers }};
  70. {% endif %}
  71. ssl_prefer_server_ciphers {{ matrix_nginx_proxy_ssl_prefer_server_ciphers }};
  72. {% if matrix_nginx_proxy_ocsp_stapling_enabled %}
  73. ssl_stapling on;
  74. ssl_stapling_verify on;
  75. ssl_trusted_certificate {{ matrix_ssl_config_dir_path }}/live/{{ matrix_nginx_proxy_proxy_element_hostname }}/chain.pem;
  76. {% endif %}
  77. {% if matrix_nginx_proxy_ssl_session_tickets_off %}
  78. ssl_session_tickets off;
  79. {% endif %}
  80. ssl_session_cache {{ matrix_nginx_proxy_ssl_session_cache }};
  81. ssl_session_timeout {{ matrix_nginx_proxy_ssl_session_timeout }};
  82. {{ render_vhost_directives() }}
  83. }
  84. {% endif %}