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

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