NOC online · 24/7Longview, TX · +1 323 412 0665
KinetikatechServers · Security · Websites
DE

Diese ausführliche Anleitung ist auf Englisch verfügbar.

English version

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.

Kernpunkte

  • 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

Synapse homeserver configuration yaml
server_name: chat.example.com
listeners:
  - port: 8008
    tls: false
    bind_addresses: ['127.0.0.1']
    type: http
    resources:
      - names: [client, federation]
database:
  name: psycopg2
  args:
    user: synapse
    password: change-me
    database: synapse
    host: 127.0.0.1
federation_domain_whitelist: []
encryption_enabled_by_default_for_room_type: all
media_store_path: /var/lib/matrix-synapse/media
max_upload_size: 100M
coturn configuration ini
listening-port=3478
fingerprint
lt-cred-mech
use-auth-secret
static-auth-secret=change-me
realm=chat.example.com
total-quota=100
cert=/etc/letsencrypt/live/chat.example.com/fullchain.pem
pkey=/etc/letsencrypt/live/chat.example.com/privkey.pem
Reverse proxy for Matrix nginx
server {
  listen 443 ssl http2;
  server_name chat.example.com;
  location /_matrix/ {
    proxy_pass http://127.0.0.1:8008;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $remote_addr;
  }
  location /.well-known/matrix/ {
    alias /var/www/matrix-well-known/;
  }
}

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.

Häufige Fragen

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.

Wie Kinetikatech bei self-hosted open source infrastructure hilft

Sie müssen kein self-hosted open source infrastructure-Experte werden: Running sovereign collaboration, storage, and identity stacks on hardware you control. Genau dafür gibt es Serververwaltung und Website-Wartung: Einrichtung, Härtung, Überwachung und ein Bereitschaftsingenieur Tag und Nacht.

Mit einem Ingenieur sprechen

Serverproblem? Gehackte Website? Langsame Seite?

Kritische Störungen in 30 Minuten beantwortet — rund um die Uhr, 7 Tage die Woche.

Notfall-Support anfordern support@kinetikatech.com