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

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