Matrix Docker Ansible eploy
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 

107 linhas
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. # duplicate X-Content-Type-Options & X-Frame-Options header
  11. # Enabled by grafana by default
  12. # add_header X-Content-Type-Options nosniff;
  13. # add_header X-Frame-Options SAMEORIGIN;
  14. add_header Referrer-Policy "strict-origin-when-cross-origin";
  15. {% if matrix_nginx_proxy_floc_optout_enabled %}
  16. add_header Permissions-Policy interest-cohort=() always;
  17. {% endif %}
  18. proxy_cookie_path / "/; HTTPOnly; Secure";
  19. {% for configuration_block in matrix_nginx_proxy_proxy_grafana_additional_server_configuration_blocks %}
  20. {{- configuration_block }}
  21. {% endfor %}
  22. location / {
  23. {% if matrix_nginx_proxy_enabled %}
  24. {# Use the embedded DNS resolver in Docker containers to discover the service #}
  25. resolver 127.0.0.11 valid=5s;
  26. set $backend "matrix-grafana:3000";
  27. proxy_pass http://$backend;
  28. {% else %}
  29. {# Generic configuration for use outside of our container setup #}
  30. proxy_pass http://127.0.0.1:3000;
  31. {% endif %}
  32. proxy_set_header Host $host;
  33. proxy_set_header X-Forwarded-For $remote_addr;
  34. }
  35. {% endmacro %}
  36. server {
  37. listen {{ 8080 if matrix_nginx_proxy_enabled else 80 }};
  38. server_name {{ matrix_nginx_proxy_proxy_grafana_hostname }};
  39. server_tokens off;
  40. root /dev/null;
  41. {% if matrix_nginx_proxy_https_enabled %}
  42. location /.well-known/acme-challenge {
  43. {% if matrix_nginx_proxy_enabled %}
  44. {# Use the embedded DNS resolver in Docker containers to discover the service #}
  45. resolver 127.0.0.11 valid=5s;
  46. set $backend "matrix-certbot:8080";
  47. proxy_pass http://$backend;
  48. {% else %}
  49. {# Generic configuration for use outside of our container setup #}
  50. proxy_pass http://127.0.0.1:{{ matrix_ssl_lets_encrypt_certbot_standalone_http_port }};
  51. {% endif %}
  52. }
  53. location / {
  54. return 301 https://$http_host$request_uri;
  55. }
  56. {% else %}
  57. {{ render_vhost_directives() }}
  58. {% endif %}
  59. }
  60. {% if matrix_nginx_proxy_https_enabled %}
  61. server {
  62. listen {{ 8443 if matrix_nginx_proxy_enabled else 443 }} ssl http2;
  63. listen [::]:{{ 8443 if matrix_nginx_proxy_enabled else 443 }} ssl http2;
  64. server_name {{ matrix_nginx_proxy_proxy_grafana_hostname }};
  65. server_tokens off;
  66. root /dev/null;
  67. ssl_certificate {{ matrix_ssl_config_dir_path }}/live/{{ matrix_nginx_proxy_proxy_grafana_hostname }}/fullchain.pem;
  68. ssl_certificate_key {{ matrix_ssl_config_dir_path }}/live/{{ matrix_nginx_proxy_proxy_grafana_hostname }}/privkey.pem;
  69. ssl_protocols {{ matrix_nginx_proxy_ssl_protocols }};
  70. {% if matrix_nginx_proxy_ssl_ciphers != "" %}
  71. ssl_ciphers {{ matrix_nginx_proxy_ssl_ciphers }};
  72. {% endif %}
  73. ssl_prefer_server_ciphers {{ matrix_nginx_proxy_ssl_prefer_server_ciphers }};
  74. {% if matrix_nginx_proxy_ocsp_stapling_enabled %}
  75. ssl_stapling on;
  76. ssl_stapling_verify on;
  77. ssl_trusted_certificate {{ matrix_ssl_config_dir_path }}/live/{{ matrix_nginx_proxy_proxy_grafana_hostname }}/chain.pem;
  78. {% endif %}
  79. {% if matrix_nginx_proxy_ssl_session_tickets_off %}
  80. ssl_session_tickets off;
  81. {% endif %}
  82. ssl_session_cache {{ matrix_nginx_proxy_ssl_session_cache }};
  83. ssl_session_timeout {{ matrix_nginx_proxy_ssl_session_timeout }};
  84. {{ render_vhost_directives() }}
  85. }
  86. {% endif %}