Matrix Docker Ansible eploy
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 

98 行
3.7 KiB

  1. global
  2. log /dev/log local0
  3. log /dev/log local1 notice
  4. chroot /var/lib/haproxy
  5. stats socket /run/haproxy/admin.sock mode 660 level admin
  6. stats timeout 30s
  7. user haproxy
  8. group haproxy
  9. daemon
  10. # Default SSL material locations
  11. ca-base /etc/ssl/certs
  12. crt-base /etc/ssl/private
  13. # Default ciphers to use on SSL-enabled listening sockets.
  14. # For more information, see ciphers(1SSL). This list is from:
  15. # https://hynek.me/articles/hardening-your-web-servers-ssl-ciphers/
  16. ssl-default-bind-ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS
  17. ssl-default-bind-options no-sslv3
  18. defaults
  19. log global
  20. mode http
  21. option httplog
  22. option dontlognull
  23. option forwardfor
  24. option redispatch
  25. timeout connect 5000
  26. timeout client 50000
  27. timeout server 50000
  28. errorfile 400 /etc/haproxy/errors/400.http
  29. errorfile 403 /etc/haproxy/errors/403.http
  30. errorfile 408 /etc/haproxy/errors/408.http
  31. errorfile 500 /etc/haproxy/errors/500.http
  32. errorfile 502 /etc/haproxy/errors/502.http
  33. errorfile 503 /etc/haproxy/errors/503.http
  34. errorfile 504 /etc/haproxy/errors/504.http
  35. frontend https-frontend
  36. bind *:80
  37. # HAproxy wants the full chain and the private key in one file. For Letsencrypt manually generated certs (e.g., wildcard certs) you can use
  38. # cat /etc/letsencrypt/live/example.com/fullchain.pem /etc/letsencrypt/live/example.com/privkey.pem > /etc/haproxy/certs/star-example.com.pem
  39. bind *:443 ssl crt /etc/haproxy/certs/star-example.com.pem
  40. #bind *:443 ssl crt /etc/haproxy/certs/element.example.com.pem /etc/haproxy/certs/matrix.example.com.pem
  41. reqadd X-Forwarded-Proto:\ https
  42. option httplog
  43. option http-server-close
  44. #
  45. # Matrix
  46. #
  47. # matrix.example.com
  48. acl matrix_domain hdr_dom(host) -i matrix.example.com
  49. acl static_files path -i -m beg /.well-known/matrix
  50. use_backend nginx-static if static_files
  51. # /_matrix/identity and /_matrix/client/r0/user_directory/search
  52. acl matrix_identity path -i -m beg /_matrix/identity
  53. acl matrix_search path -i -m beg /_matrix/client/r0/user_directory/search
  54. # Send to :8090
  55. use_backend matrix-supporting if matrix_identity or matrix_search
  56. # /_matrix and /_synapse/admin
  57. acl matrix_path path -i -m beg /_matrix
  58. acl synapse_admin path -i -m beg /_synapse/admin
  59. # Send to :8008
  60. use_backend matrix-main if matrix_path or synapse_admin
  61. # element.example.com
  62. acl element_domain hdr_dom(host) -i element.example.com
  63. # Send to 8765
  64. use_backend element if element_domain
  65. # If nothing else match, just send to default matrix backend
  66. use_backend matrix-main if matrix_domain
  67. #default_backend matrix-main
  68. frontend matrix-federation
  69. bind *:8448 ssl crt /etc/haproxy/certs/star-example.com.pem
  70. reqadd X-Forwarded-Proto:\ https
  71. option httplog
  72. option http-server-close
  73. default_backend synapse
  74. backend matrix-supporting
  75. server matrix-supporting 127.0.0.1:8090 check
  76. backend matrix-main
  77. server matrix-main 127.0.0.1:8008 check
  78. backend synapse
  79. server synapse 127.0.0.1:8048 check
  80. backend nginx-static
  81. capture request header origin len 128
  82. http-response add-header Access-Control-Allow-Origin *
  83. rspadd Access-Control-Allow-Methods:\ GET,\ HEAD,\ OPTIONS,\ POST,\ PUT if { capture.req.hdr(0) -m found }
  84. rspadd Access-Control-Allow-Credentials:\ true if { capture.req.hdr(0) -m found }
  85. rspadd Access-Control-Allow-Headers:\ Origin,\ Accept,\ X-Requested-With,\ Content-Type,\ Access-Control-Request-Method,\ Access-Control-Request-Headers,\ Authorization if { capture.req.hdr(0) -m found }
  86. server nginx 127.0.0.1:40888 check
  87. backend element
  88. server element 127.0.0.1:8765 check