Self-Hosted Open Source Infrastructure
Deploying a Private Matrix Synapse Messaging Network with End-to-End Encryption and Turn Servers
Matrix provides federated, end-to-end encrypted messaging that you can run entirely on your own infrastructure. Synapse is the reference server, and a TURN server handles voice and video relay. This guide deploys a private network with federation disabled, E2EE enforced, and media stored locally.
Points clés
- Disable federation for a private network. Set federation_domain_whitelist to empty and block inbound federation traffic.
- Enforce end-to-end encryption. Configure the server to reject unencrypted rooms and require device verification.
- Deploy a TURN server. coturn relays voice and video when direct peer connections fail.
- Store media locally. Use the local media store with a retention policy rather than an external S3 backend for small deployments.
- Set up a reverse proxy. Nginx or Caddy terminates TLS and routes Matrix and TURN traffic.
- Configure well-known endpoints. .well-known/matrix/server and /client tell clients where to connect.
- Back up the database. PostgreSQL holds all messages and keys; automate dumps and test restores.
- Monitor federation attempts. Even with federation disabled, log and alert on any inbound federation traffic.
Architecture
Clients connect through a reverse proxy to Synapse, which stores messages and keys in PostgreSQL. Media lives on local disk. TURN handles NAT traversal for calls. With federation disabled, the network is a closed island with full control over membership and data.
Production configuration
Edge cases from production
- E2EE key backup must be enabled by users; server-side recovery is not possible by design.
- Media retention policies delete files but leave database references; run the media cleanup job regularly.
- TURN credentials expire; clients must fetch fresh credentials from Synapse before each call.
- Federation disabled means no external users; plan membership provisioning via SSO or manual invites.
Questions fréquentes
Can I federate later?
Yes, remove the federation block and configure DNS; existing rooms remain private unless explicitly federated.
Is Matrix E2EE by default?
Rooms can be created with encryption enabled by default, but users must verify devices for full security.
How much storage does media consume?
Depends on upload volume; set retention policies and monitor disk usage.
Can I use an external database?
Yes, Synapse supports PostgreSQL and the database can be on a separate host.
What clients work best?
Element Web and mobile apps are the reference clients with full E2EE support.
Comment Kinetikatech vous aide avec self-hosted open source infrastructure
Voici l'essentiel : Running sovereign collaboration, storage, and identity stacks on hardware you control. Confiez-le à notre service Gestion de serveurs et Maintenance web et c'est couvert : évalué correctement, mis en œuvre proprement, supervisé jour et nuit.