Matrix Docker Ansible eploy
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 

73 rader
2.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. {% for configuration_block in matrix_nginx_proxy_proxy_dimension_additional_server_configuration_blocks %}
  6. {{- configuration_block }}
  7. {% endfor %}
  8. location / {
  9. {% if matrix_nginx_proxy_enabled %}
  10. {# Use the embedded DNS resolver in Docker containers to discover the service #}
  11. resolver 127.0.0.11 valid=5s;
  12. set $backend "matrix-dimension:8184";
  13. proxy_pass http://$backend;
  14. {% else %}
  15. {# Generic configuration for use outside of our container setup #}
  16. proxy_pass http://127.0.0.1:8184;
  17. {% endif %}
  18. proxy_set_header Host $host;
  19. proxy_set_header X-Forwarded-For $remote_addr;
  20. }
  21. {% endmacro %}
  22. server {
  23. listen {{ 8080 if matrix_nginx_proxy_enabled else 80 }};
  24. server_name {{ matrix_nginx_proxy_proxy_dimension_hostname }};
  25. server_tokens off;
  26. root /dev/null;
  27. {% if matrix_nginx_proxy_https_enabled %}
  28. location /.well-known/acme-challenge {
  29. {% if matrix_nginx_proxy_enabled %}
  30. {# Use the embedded DNS resolver in Docker containers to discover the service #}
  31. resolver 127.0.0.11 valid=5s;
  32. set $backend "matrix-certbot:8080";
  33. proxy_pass http://$backend;
  34. {% else %}
  35. {# Generic configuration for use outside of our container setup #}
  36. proxy_pass http://127.0.0.1:{{ matrix_ssl_lets_encrypt_certbot_standalone_http_port }};
  37. {% endif %}
  38. }
  39. location / {
  40. return 301 https://$http_host$request_uri;
  41. }
  42. {% else %}
  43. {{ render_vhost_directives() }}
  44. {% endif %}
  45. }
  46. {% if matrix_nginx_proxy_https_enabled %}
  47. server {
  48. listen {{ 8443 if matrix_nginx_proxy_enabled else 443 }} ssl http2;
  49. listen [::]:{{ 8443 if matrix_nginx_proxy_enabled else 443 }} ssl http2;
  50. server_name {{ matrix_nginx_proxy_proxy_dimension_hostname }};
  51. server_tokens off;
  52. root /dev/null;
  53. ssl_certificate {{ matrix_ssl_config_dir_path }}/live/{{ matrix_nginx_proxy_proxy_dimension_hostname }}/fullchain.pem;
  54. ssl_certificate_key {{ matrix_ssl_config_dir_path }}/live/{{ matrix_nginx_proxy_proxy_dimension_hostname }}/privkey.pem;
  55. ssl_protocols {{ matrix_nginx_proxy_ssl_protocols }};
  56. ssl_prefer_server_ciphers on;
  57. ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH";
  58. {{ render_vhost_directives() }}
  59. }
  60. {% endif %}