Matrix Docker Ansible eploy
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

100 rivejä
3.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. {% if matrix_nginx_proxy_hsts_preload_enabled %}
  6. add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
  7. {% else %}
  8. add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
  9. {% endif %}
  10. add_header X-XSS-Protection "{{ matrix_nginx_proxy_xss_protection }}";
  11. add_header X-Content-Type-Options nosniff;
  12. add_header X-Frame-Options DENY;
  13. {% for configuration_block in matrix_nginx_proxy_proxy_sygnal_additional_server_configuration_blocks %}
  14. {{- configuration_block }}
  15. {% endfor %}
  16. location / {
  17. {% if matrix_nginx_proxy_enabled %}
  18. {# Use the embedded DNS resolver in Docker containers to discover the service #}
  19. resolver {{ matrix_nginx_proxy_http_level_resolver }} valid=5s;
  20. set $backend "matrix-sygnal:6000";
  21. proxy_pass http://$backend;
  22. {% else %}
  23. {# Generic configuration for use outside of our container setup #}
  24. proxy_pass http://127.0.0.1:6000;
  25. {% endif %}
  26. proxy_set_header Host $host;
  27. proxy_set_header X-Forwarded-For {{ matrix_nginx_proxy_x_forwarded_for }};
  28. proxy_set_header X-Forwarded-Proto {{ matrix_nginx_proxy_x_forwarded_proto_value }};
  29. }
  30. {% endmacro %}
  31. server {
  32. listen {{ 8080 if matrix_nginx_proxy_enabled else 80 }};
  33. listen [::]:{{ 8080 if matrix_nginx_proxy_enabled else 80 }};
  34. server_name {{ matrix_nginx_proxy_proxy_sygnal_hostname }};
  35. server_tokens off;
  36. root /dev/null;
  37. {% if matrix_nginx_proxy_https_enabled %}
  38. location /.well-known/acme-challenge {
  39. {% if matrix_nginx_proxy_enabled %}
  40. {# Use the embedded DNS resolver in Docker containers to discover the service #}
  41. resolver {{ matrix_nginx_proxy_http_level_resolver }} valid=5s;
  42. set $backend "matrix-certbot:8080";
  43. proxy_pass http://$backend;
  44. {% else %}
  45. {# Generic configuration for use outside of our container setup #}
  46. proxy_pass http://127.0.0.1:{{ matrix_ssl_lets_encrypt_certbot_standalone_http_port }};
  47. {% endif %}
  48. }
  49. location / {
  50. return 301 https://$http_host$request_uri;
  51. }
  52. {% else %}
  53. {{ render_vhost_directives() }}
  54. {% endif %}
  55. }
  56. {% if matrix_nginx_proxy_https_enabled %}
  57. server {
  58. listen {{ 8443 if matrix_nginx_proxy_enabled else 443 }} ssl http2;
  59. listen [::]:{{ 8443 if matrix_nginx_proxy_enabled else 443 }} ssl http2;
  60. server_name {{ matrix_nginx_proxy_proxy_sygnal_hostname }};
  61. server_tokens off;
  62. root /dev/null;
  63. ssl_certificate {{ matrix_ssl_config_dir_path }}/live/{{ matrix_nginx_proxy_proxy_sygnal_hostname }}/fullchain.pem;
  64. ssl_certificate_key {{ matrix_ssl_config_dir_path }}/live/{{ matrix_nginx_proxy_proxy_sygnal_hostname }}/privkey.pem;
  65. ssl_protocols {{ matrix_nginx_proxy_ssl_protocols }};
  66. {% if matrix_nginx_proxy_ssl_ciphers != '' %}
  67. ssl_ciphers {{ matrix_nginx_proxy_ssl_ciphers }};
  68. {% endif %}
  69. ssl_prefer_server_ciphers {{ matrix_nginx_proxy_ssl_prefer_server_ciphers }};
  70. {% if matrix_nginx_proxy_ocsp_stapling_enabled %}
  71. ssl_stapling on;
  72. ssl_stapling_verify on;
  73. ssl_trusted_certificate {{ matrix_ssl_config_dir_path }}/live/{{ matrix_nginx_proxy_proxy_sygnal_hostname }}/chain.pem;
  74. {% endif %}
  75. {% if matrix_nginx_proxy_ssl_session_tickets_off %}
  76. ssl_session_tickets off;
  77. {% endif %}
  78. ssl_session_cache {{ matrix_nginx_proxy_ssl_session_cache }};
  79. ssl_session_timeout {{ matrix_nginx_proxy_ssl_session_timeout }};
  80. {{ render_vhost_directives() }}
  81. }
  82. {% endif %}