Matrix Docker Ansible eploy
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 

100 行
3.3 KiB

  1. #jinja2: lstrip_blocks: "True"
  2. {% macro render_vhost_directives() %}
  3. absolute_redirect off;
  4. root {{ matrix_nginx_proxy_data_path_in_container if matrix_nginx_proxy_enabled else matrix_nginx_proxy_data_path }}{{ matrix_nginx_proxy_data_path_extension }};
  5. index index.html index.htm;
  6. try_files $uri $uri/ =404;
  7. gzip on;
  8. gzip_types text/plain application/json;
  9. {% if matrix_nginx_proxy_floc_optout_enabled %}
  10. add_header Permissions-Policy interest-cohort=() always;
  11. {% endif %}
  12. {% if matrix_nginx_proxy_hsts_preload_enabled %}
  13. add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
  14. {% else %}
  15. add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
  16. {% endif %}
  17. add_header X-XSS-Protection "{{ matrix_nginx_proxy_xss_protection }}";
  18. {% for configuration_block in matrix_nginx_proxy_proxy_domain_additional_server_configuration_blocks %}
  19. {{- configuration_block }}
  20. {% endfor %}
  21. location /.well-known/matrix {
  22. root {{ matrix_static_files_base_path }};
  23. {#
  24. A somewhat long expires value is used to prevent outages
  25. in case this is unreachable due to network failure.
  26. #}
  27. expires 4h;
  28. default_type application/json;
  29. add_header Access-Control-Allow-Origin *;
  30. }
  31. {% endmacro %}
  32. server {
  33. listen {{ 8080 if matrix_nginx_proxy_enabled else 80 }};
  34. listen [::]:{{ 8080 if matrix_nginx_proxy_enabled else 80 }};
  35. server_name {{ matrix_nginx_proxy_base_domain_hostname }};
  36. server_tokens off;
  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_base_domain_hostname }};
  61. server_tokens off;
  62. ssl_certificate {{ matrix_ssl_config_dir_path }}/live/{{ matrix_nginx_proxy_base_domain_hostname }}/fullchain.pem;
  63. ssl_certificate_key {{ matrix_ssl_config_dir_path }}/live/{{ matrix_nginx_proxy_base_domain_hostname }}/privkey.pem;
  64. ssl_protocols {{ matrix_nginx_proxy_ssl_protocols }};
  65. {% if matrix_nginx_proxy_ssl_ciphers != '' %}
  66. ssl_ciphers {{ matrix_nginx_proxy_ssl_ciphers }};
  67. {% endif %}
  68. ssl_prefer_server_ciphers {{ matrix_nginx_proxy_ssl_prefer_server_ciphers }};
  69. {% if matrix_nginx_proxy_ocsp_stapling_enabled %}
  70. ssl_stapling on;
  71. ssl_stapling_verify on;
  72. ssl_trusted_certificate {{ matrix_ssl_config_dir_path }}/live/{{ matrix_nginx_proxy_base_domain_hostname }}/chain.pem;
  73. {% endif %}
  74. {% if matrix_nginx_proxy_ssl_session_tickets_off %}
  75. ssl_session_tickets off;
  76. {% endif %}
  77. ssl_session_cache {{ matrix_nginx_proxy_ssl_session_cache }};
  78. ssl_session_timeout {{ matrix_nginx_proxy_ssl_session_timeout }};
  79. {{ render_vhost_directives() }}
  80. }
  81. {% endif %}