Matrix Docker Ansible eploy
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 

198 wiersze
6.8 KiB

  1. server {
  2. listen {{ 8080 if matrix_nginx_proxy_enabled else 80 }};
  3. server_name {{ matrix_nginx_proxy_proxy_matrix_hostname }};
  4. server_tokens off;
  5. location /.well-known/acme-challenge {
  6. {% if matrix_nginx_proxy_enabled %}
  7. {# Use the embedded DNS resolver in Docker containers to discover the service #}
  8. resolver 127.0.0.11 valid=5s;
  9. set $backend "matrix-certbot:8080";
  10. proxy_pass http://$backend;
  11. {% else %}
  12. {# Generic configuration for use outside of our container setup #}
  13. proxy_pass http://127.0.0.1:{{ matrix_ssl_lets_encrypt_certbot_standalone_http_port }};
  14. {% endif %}
  15. }
  16. location / {
  17. return 301 https://$http_host$request_uri;
  18. }
  19. }
  20. server {
  21. listen {{ 8443 if matrix_nginx_proxy_enabled else 443 }} ssl http2;
  22. listen [::]:{{ 8443 if matrix_nginx_proxy_enabled else 443 }} ssl http2;
  23. server_name {{ matrix_nginx_proxy_proxy_matrix_hostname }};
  24. server_tokens off;
  25. root /dev/null;
  26. gzip on;
  27. gzip_types text/plain application/json;
  28. ssl_certificate {{ matrix_ssl_config_dir_path }}/live/{{ matrix_nginx_proxy_proxy_matrix_hostname }}/fullchain.pem;
  29. ssl_certificate_key {{ matrix_ssl_config_dir_path }}/live/{{ matrix_nginx_proxy_proxy_matrix_hostname }}/privkey.pem;
  30. ssl_protocols {{ matrix_nginx_proxy_ssl_protocols }};
  31. ssl_prefer_server_ciphers on;
  32. ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH";
  33. location /.well-known/matrix {
  34. root {{ matrix_static_files_base_path }};
  35. {#
  36. A somewhat long expires value is used to prevent outages
  37. in case this is unreachable due to network failure or
  38. due to the base domain's server completely dying.
  39. #}
  40. expires 4h;
  41. default_type application/json;
  42. add_header Access-Control-Allow-Origin *;
  43. }
  44. {% if matrix_nginx_proxy_proxy_matrix_corporal_api_enabled %}
  45. location /_matrix/corporal {
  46. {% if matrix_nginx_proxy_enabled %}
  47. {# Use the embedded DNS resolver in Docker containers to discover the service #}
  48. resolver 127.0.0.11 valid=5s;
  49. set $backend "{{ matrix_nginx_proxy_proxy_matrix_corporal_api_addr_with_container }}";
  50. proxy_pass http://$backend;
  51. {% else %}
  52. {# Generic configuration for use outside of our container setup #}
  53. proxy_pass http://{{ matrix_nginx_proxy_proxy_matrix_corporal_api_addr_sans_container }};
  54. {% endif %}
  55. proxy_set_header Host $host;
  56. proxy_set_header X-Forwarded-For $remote_addr;
  57. }
  58. {% endif %}
  59. {% if matrix_nginx_proxy_proxy_matrix_identity_api_enabled %}
  60. location /_matrix/identity {
  61. {% if matrix_nginx_proxy_enabled %}
  62. {# Use the embedded DNS resolver in Docker containers to discover the service #}
  63. resolver 127.0.0.11 valid=5s;
  64. set $backend "{{ matrix_nginx_proxy_proxy_matrix_identity_api_addr_with_container }}";
  65. proxy_pass http://$backend;
  66. {% else %}
  67. {# Generic configuration for use outside of our container setup #}
  68. proxy_pass http://{{ matrix_nginx_proxy_proxy_matrix_identity_api_addr_sans_container }};
  69. {% endif %}
  70. proxy_set_header Host $host;
  71. proxy_set_header X-Forwarded-For $remote_addr;
  72. }
  73. {% endif %}
  74. {% if matrix_nginx_proxy_proxy_matrix_user_directory_search_enabled %}
  75. location /_matrix/client/r0/user_directory/search {
  76. {% if matrix_nginx_proxy_enabled %}
  77. {# Use the embedded DNS resolver in Docker containers to discover the service #}
  78. resolver 127.0.0.11 valid=5s;
  79. set $backend "{{ matrix_nginx_proxy_proxy_matrix_user_directory_search_addr_with_container }}";
  80. proxy_pass http://$backend;
  81. {% else %}
  82. {# Generic configuration for use outside of our container setup #}
  83. proxy_pass http://{{ matrix_nginx_proxy_proxy_matrix_user_directory_search_addr_sans_container }};
  84. {% endif %}
  85. proxy_set_header Host $host;
  86. proxy_set_header X-Forwarded-For $remote_addr;
  87. }
  88. {% endif %}
  89. {% for configuration_block in matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks %}
  90. {{- configuration_block }}
  91. {% endfor %}
  92. {#
  93. This handles the Matrix Client API only.
  94. The Matrix Federation API is handled by a separate vhost.
  95. #}
  96. location /_matrix {
  97. {% if matrix_nginx_proxy_enabled %}
  98. {# Use the embedded DNS resolver in Docker containers to discover the service #}
  99. resolver 127.0.0.11 valid=5s;
  100. set $backend "{{ matrix_nginx_proxy_proxy_matrix_client_api_addr_with_container }}";
  101. proxy_pass http://$backend;
  102. {% else %}
  103. {# Generic configuration for use outside of our container setup #}
  104. proxy_pass http://{{ matrix_nginx_proxy_proxy_matrix_client_api_addr_sans_container }};
  105. {% endif %}
  106. proxy_set_header Host $host;
  107. proxy_set_header X-Forwarded-For $remote_addr;
  108. client_body_buffer_size 25M;
  109. client_max_body_size {{ matrix_nginx_proxy_proxy_matrix_client_api_client_max_body_size_mb }}M;
  110. proxy_max_temp_file_size 0;
  111. }
  112. {% if matrix_nginx_proxy_proxy_synapse_metrics %}
  113. location /_synapse/metrics {
  114. {% if matrix_nginx_proxy_enabled %}
  115. {# Use the embedded DNS resolver in Docker containers to discover the service #}
  116. resolver 127.0.0.11 valid=5s;
  117. set $backend "{{ matrix_nginx_proxy_proxy_synapse_metrics_addr_with_container }}";
  118. proxy_pass http://$backend;
  119. {% else %}
  120. {# Generic configuration for use outside of our container setup #}
  121. proxy_pass http://{{ matrix_nginx_proxy_proxy_synapse_metrics_addr_sans_container }};
  122. {% endif %}
  123. proxy_set_header Host $host;
  124. proxy_set_header X-Forwarded-For $remote_addr;
  125. {% if matrix_nginx_proxy_proxy_synapse_metrics_basic_auth_enabled %}
  126. auth_basic "protected";
  127. auth_basic_user_file .matrix-synapse-metrics-htpasswd;
  128. {% endif %}
  129. }
  130. {% endif %}
  131. location / {
  132. rewrite ^/$ /_matrix/static/ last;
  133. }
  134. }
  135. {% if matrix_nginx_proxy_proxy_matrix_federation_api_enabled %}
  136. server {
  137. listen 8448 ssl http2;
  138. listen [::]:8448 ssl http2;
  139. server_name {{ matrix_nginx_proxy_proxy_matrix_hostname }};
  140. server_tokens off;
  141. root /dev/null;
  142. gzip on;
  143. gzip_types text/plain application/json;
  144. ssl_certificate {{ matrix_nginx_proxy_proxy_matrix_federation_api_ssl_certificate }};
  145. ssl_certificate_key {{ matrix_nginx_proxy_proxy_matrix_federation_api_ssl_certificate_key }};
  146. ssl_protocols {{ matrix_nginx_proxy_ssl_protocols }};
  147. ssl_prefer_server_ciphers on;
  148. ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH";
  149. location / {
  150. {% if matrix_nginx_proxy_enabled %}
  151. {# Use the embedded DNS resolver in Docker containers to discover the service #}
  152. resolver 127.0.0.11 valid=5s;
  153. set $backend "{{ matrix_nginx_proxy_proxy_matrix_federation_api_addr_with_container }}";
  154. proxy_pass http://$backend;
  155. {% else %}
  156. {# Generic configuration for use outside of our container setup #}
  157. proxy_pass http://{{ matrix_nginx_proxy_proxy_matrix_federation_api_addr_sans_container }};
  158. {% endif %}
  159. proxy_set_header Host $host;
  160. proxy_set_header X-Forwarded-For $remote_addr;
  161. client_body_buffer_size 25M;
  162. client_max_body_size {{ matrix_nginx_proxy_proxy_matrix_federation_api_client_max_body_size_mb }}M;
  163. proxy_max_temp_file_size 0;
  164. }
  165. }
  166. {% endif %}