Matrix Docker Ansible eploy
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

135 line
4.9 KiB

  1. # This is a sample file demonstrating how to set up reverse-proxy for matrix.DOMAIN
  2. <VirtualHost *:80>
  3. ServerName matrix.DOMAIN
  4. ProxyVia On
  5. # Map /.well-known/acme-challenge to the certbot server
  6. # If you manage SSL certificates by yourself, this will differ.
  7. <Location /.well-known/acme-challenge>
  8. ProxyPreserveHost On
  9. ProxyPass http://127.0.0.1:2402/.well-known/acme-challenge
  10. </Location>
  11. Redirect permanent / https://matrix.DOMAIN/
  12. </VirtualHost>
  13. # Client-Server API
  14. <VirtualHost *:443>
  15. ServerName matrix.DOMAIN
  16. SSLEngine On
  17. # If you manage SSL certificates by yourself, these paths will differ.
  18. SSLCertificateFile /matrix/ssl/config/live/matrix.DOMAIN/fullchain.pem
  19. SSLCertificateKeyFile /matrix/ssl/config/live/matrix.DOMAIN/privkey.pem
  20. SSLProxyEngine on
  21. SSLProxyProtocol +TLSv1.2 +TLSv1.3
  22. SSLCipherSuite EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH
  23. ProxyPreserveHost On
  24. ProxyRequests Off
  25. ProxyVia On
  26. RequestHeader set "X-Forwarded-Proto" expr=%{REQUEST_SCHEME}
  27. # Keep some URIs free for different proxy/location
  28. ProxyPassMatch ^/.well-known/matrix/client !
  29. ProxyPassMatch ^/.well-known/matrix/server !
  30. ProxyPassMatch ^/_matrix/identity !
  31. ProxyPassMatch ^/_matrix/client/r0/user_directory/search !
  32. # Proxy all remaining traffic to Synapse
  33. AllowEncodedSlashes NoDecode
  34. ProxyPass /_matrix http://127.0.0.1:8008/_matrix retry=0 nocanon
  35. ProxyPassReverse /_matrix http://127.0.0.1:8008/_matrix
  36. ProxyPass /_synapse/client http://127.0.0.1:8008/_synapse/client retry=0 nocanon
  37. ProxyPassReverse /_synapse/client http://127.0.0.1:8008/_synapse/client
  38. # Proxy Admin API (necessary for Synapse-Admin)
  39. # ProxyPass /_synapse/admin http://127.0.0.1:8008/_synapse/admin retry=0 nocanon
  40. # ProxyPassReverse /_synapse/admin http://127.0.0.1:8008/_synapse/admin
  41. # Proxy Synapse-Admin
  42. # ProxyPass /synapse-admin http://127.0.0.1:8766 retry=0 nocanon
  43. # ProxyPassReverse /synapse-admin http://127.0.0.1:8766
  44. # Map /.well-known/matrix/client for client discovery
  45. Alias /.well-known/matrix/client /matrix/static-files/.well-known/matrix/client
  46. <Files "/matrix/static-files/.well-known/matrix/client">
  47. Require all granted
  48. </Files>
  49. <Location "/.well-known/matrix/client">
  50. Header always set Content-Type "application/json"
  51. Header always set Access-Control-Allow-Origin "*"
  52. </Location>
  53. # Map /.well-known/matrix/server for server discovery
  54. Alias /.well-known/matrix/server /matrix/static-files/.well-known/matrix/server
  55. <Files "/matrix/static-files/.well-known/matrix/server">
  56. Require all granted
  57. </Files>
  58. <Location "/.well-known/matrix/server">
  59. Header always set Content-Type "application/json"
  60. </Location>
  61. <Directory /matrix/static-files/.well-known/matrix/>
  62. AllowOverride All
  63. # Apache 2.4:
  64. Require all granted
  65. # Or for Apache 2.2:
  66. #order allow,deny
  67. </Directory>
  68. # Map /_matrix/identity to the identity server
  69. <Location /_matrix/identity>
  70. ProxyPass http://127.0.0.1:8090/_matrix/identity nocanon
  71. </Location>
  72. # Map /_matrix/client/r0/user_directory/search to the identity server
  73. <Location /_matrix/client/r0/user_directory/search>
  74. ProxyPass http://127.0.0.1:8090/_matrix/client/r0/user_directory/search nocanon
  75. </Location>
  76. ErrorLog ${APACHE_LOG_DIR}/matrix.DOMAIN-error.log
  77. CustomLog ${APACHE_LOG_DIR}/matrix.DOMAIN-access.log combined
  78. </VirtualHost>
  79. # Server-Server (federation) API
  80. # Use this apache reverse proxy template to enable matrix server-to-server federation traffic
  81. # Be sure that network traffic on port 8448 is possible
  82. #
  83. # You can check your federation config at https://federationtester.matrix.org/
  84. # Enter there your base DOMAIN address, NOT your matrix.DOMAIN address, ex. https://DOMAIN
  85. #
  86. # In this example we use all services on the same machine (127.0.0.1) but you can do this with different machines.
  87. # If you do so be sure to reach the destinated IPADRESS and the correspondending port. Check this with netstat, nmap or your favourite tool.
  88. Listen 8448
  89. <VirtualHost *:8448>
  90. ServerName matrix.DOMAIN
  91. SSLEngine On
  92. # If you manage SSL certificates by yourself, these paths will differ.
  93. SSLCertificateFile /matrix/ssl/config/live/matrix.DOMAIN/fullchain.pem
  94. SSLCertificateKeyFile /matrix/ssl/config/live/matrix.DOMAIN/privkey.pem
  95. SSLProxyEngine on
  96. SSLProxyProtocol +TLSv1.2 +TLSv1.3
  97. SSLCipherSuite EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH
  98. ProxyPreserveHost On
  99. ProxyRequests Off
  100. ProxyVia On
  101. RequestHeader set "X-Forwarded-Proto" expr=%{REQUEST_SCHEME}
  102. # Proxy all remaining traffic to the Synapse port
  103. # Beware: In this example the local traffic goes to the local synapse server at 127.0.0.1
  104. # Of course you can use another IPADRESS in case of using other synapse servers in your network
  105. AllowEncodedSlashes NoDecode
  106. ProxyPass /_matrix http://127.0.0.1:8048/_matrix retry=0 nocanon
  107. ProxyPassReverse /_matrix http://127.0.0.1:8048/_matrix
  108. ErrorLog ${APACHE_LOG_DIR}/matrix.DOMAIN-error.log
  109. CustomLog ${APACHE_LOG_DIR}/matrix.DOMAIN-access.log combined
  110. </VirtualHost>