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.
 
 

93 wiersze
3.7 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. {% for configuration_block in matrix_nginx_proxy_proxy_dimension_additional_server_configuration_blocks %}
  8. {{- configuration_block }}
  9. {% endfor %}
  10. location / {
  11. {% if matrix_nginx_proxy_enabled %}
  12. {# Use the embedded DNS resolver in Docker containers to discover the service #}
  13. resolver 127.0.0.11 valid=5s;
  14. set $backend "matrix-dimension:8184";
  15. proxy_pass http://$backend;
  16. {% else %}
  17. {# Generic configuration for use outside of our container setup #}
  18. proxy_pass http://127.0.0.1:8184;
  19. {% endif %}
  20. proxy_set_header Host $host;
  21. proxy_set_header X-Forwarded-For $remote_addr;
  22. }
  23. {% endmacro %}
  24. server {
  25. listen {{ 8080 if matrix_nginx_proxy_enabled else 80 }};
  26. server_name {{ matrix_nginx_proxy_proxy_dimension_hostname }};
  27. server_tokens off;
  28. root /dev/null;
  29. {% if matrix_nginx_proxy_https_enabled %}
  30. location /.well-known/acme-challenge {
  31. {% if matrix_nginx_proxy_enabled %}
  32. {# Use the embedded DNS resolver in Docker containers to discover the service #}
  33. resolver 127.0.0.11 valid=5s;
  34. set $backend "matrix-certbot:8080";
  35. proxy_pass http://$backend;
  36. {% else %}
  37. {# Generic configuration for use outside of our container setup #}
  38. proxy_pass http://127.0.0.1:{{ matrix_ssl_lets_encrypt_certbot_standalone_http_port }};
  39. {% endif %}
  40. }
  41. location / {
  42. return 301 https://$http_host$request_uri;
  43. }
  44. {% else %}
  45. {{ render_vhost_directives() }}
  46. {% endif %}
  47. }
  48. {% if matrix_nginx_proxy_https_enabled %}
  49. server {
  50. listen {{ 8443 if matrix_nginx_proxy_enabled else 443 }} ssl http2;
  51. listen [::]:{{ 8443 if matrix_nginx_proxy_enabled else 443 }} ssl http2;
  52. server_name {{ matrix_nginx_proxy_proxy_dimension_hostname }};
  53. server_tokens off;
  54. root /dev/null;
  55. ssl_certificate {{ matrix_ssl_config_dir_path }}/live/{{ matrix_nginx_proxy_proxy_dimension_hostname }}/fullchain.pem;
  56. ssl_certificate_key {{ matrix_ssl_config_dir_path }}/live/{{ matrix_nginx_proxy_proxy_dimension_hostname }}/privkey.pem;
  57. {% if matrix_nginx_proxy_ssl_config == "Modern" %}
  58. ssl_protocols TLSv1.3;
  59. ssl_prefer_server_ciphers off;
  60. {% elif matrix_nginx_proxy_ssl_config == "Intermediate" %}
  61. ssl_protocols TLSv1.2 TLSv1.3;
  62. ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
  63. ssl_prefer_server_ciphers off;
  64. {% elif matrix_nginx_proxy_ssl_config == "Old" %}
  65. ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
  66. ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA256:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA;
  67. ssl_prefer_server_ciphers on;
  68. {% elif matrix_nginx_proxy_ssl_config == "Custom" %}
  69. ssl_protocols {{ matrix_nginx_proxy_ssl_protocols }};
  70. ssl_prefer_server_ciphers {{ matrix_nginx_proxy_ssl_prefer_server_ciphers }};
  71. ssl_ciphers {{ matrix_nginx_proxy_ssl_ciphers }};
  72. {% endif %}
  73. {{ render_vhost_directives() }}
  74. }
  75. {% endif %}