Matrix Docker Ansible eploy
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 

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