Matrix Docker Ansible eploy
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 

81 Zeilen
2.6 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. listen [::]:{{ 8080 if matrix_nginx_proxy_enabled else 80 }};
  28. server_name {{ matrix_nginx_proxy_proxy_element_hostname }};
  29. server_tokens off;
  30. root /dev/null;
  31. {% if matrix_nginx_proxy_https_enabled %}
  32. location /.well-known/acme-challenge {
  33. {% if matrix_nginx_proxy_enabled %}
  34. {# Use the embedded DNS resolver in Docker containers to discover the service #}
  35. resolver 127.0.0.11 valid=5s;
  36. set $backend "matrix-certbot:8080";
  37. proxy_pass http://$backend;
  38. {% else %}
  39. {# Generic configuration for use outside of our container setup #}
  40. proxy_pass http://127.0.0.1:{{ matrix_ssl_lets_encrypt_certbot_standalone_http_port }};
  41. {% endif %}
  42. }
  43. location / {
  44. return 301 https://$http_host$request_uri;
  45. }
  46. {% else %}
  47. {{ render_vhost_directives() }}
  48. {% endif %}
  49. }
  50. {% if matrix_nginx_proxy_https_enabled %}
  51. server {
  52. listen {{ 8443 if matrix_nginx_proxy_enabled else 443 }} ssl http2;
  53. listen [::]:{{ 8443 if matrix_nginx_proxy_enabled else 443 }} ssl http2;
  54. server_name {{ matrix_nginx_proxy_proxy_element_hostname }};
  55. server_tokens off;
  56. root /dev/null;
  57. ssl_certificate {{ matrix_ssl_config_dir_path }}/live/{{ matrix_nginx_proxy_proxy_element_hostname }}/fullchain.pem;
  58. ssl_certificate_key {{ matrix_ssl_config_dir_path }}/live/{{ matrix_nginx_proxy_proxy_element_hostname }}/privkey.pem;
  59. ssl_protocols {{ matrix_nginx_proxy_ssl_protocols }};
  60. {% if matrix_nginx_proxy_ssl_ciphers != "" %}
  61. ssl_ciphers {{ matrix_nginx_proxy_ssl_ciphers }};
  62. {% endif %}
  63. ssl_prefer_server_ciphers {{ matrix_nginx_proxy_ssl_prefer_server_ciphers }};
  64. {{ render_vhost_directives() }}
  65. }
  66. {% endif %}