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

77 строки
2.5 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. ssl_protocols {{ matrix_nginx_proxy_ssl_protocols }};
  59. ssl_prefer_server_ciphers on;
  60. ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH";
  61. {{ render_vhost_directives() }}
  62. }
  63. {% endif %}