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

97 строки
3.1 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. add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
  6. add_header X-Content-Type-Options nosniff;
  7. add_header X-Frame-Options SAMEORIGIN;
  8. {% if matrix_nginx_proxy_floc_optout_enabled %}
  9. add_header Permissions-Policy interest-cohort=() always;
  10. {% endif %}
  11. {% for configuration_block in matrix_nginx_proxy_proxy_element_additional_server_configuration_blocks %}
  12. {{- configuration_block }}
  13. {% endfor %}
  14. location / {
  15. {% if matrix_nginx_proxy_enabled %}
  16. {# Use the embedded DNS resolver in Docker containers to discover the service #}
  17. resolver 127.0.0.11 valid=5s;
  18. set $backend "matrix-client-element:8080";
  19. proxy_pass http://$backend;
  20. {% else %}
  21. {# Generic configuration for use outside of our container setup #}
  22. proxy_pass http://127.0.0.1:8765;
  23. {% endif %}
  24. proxy_set_header Host $host;
  25. proxy_set_header X-Forwarded-For $remote_addr;
  26. }
  27. {% endmacro %}
  28. server {
  29. listen {{ 8080 if matrix_nginx_proxy_enabled else 80 }};
  30. server_name {{ matrix_nginx_proxy_proxy_element_hostname }};
  31. server_tokens off;
  32. root /dev/null;
  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_proxy_element_hostname }};
  57. server_tokens off;
  58. root /dev/null;
  59. ssl_certificate {{ matrix_ssl_config_dir_path }}/live/{{ matrix_nginx_proxy_proxy_element_hostname }}/fullchain.pem;
  60. ssl_certificate_key {{ matrix_ssl_config_dir_path }}/live/{{ matrix_nginx_proxy_proxy_element_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_proxy_element_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 %}