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

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