Self-Hosting a Matrix/Synapse Server: The Complete Guide
Own your communications. Run your own Matrix homeserver with Synapse and take back control of your data.
What Is Matrix and Synapse?
Matrix is an open standard for secure, decentralized, and interoperable real-time communications. Think of it as email but for instant messaging — anyone can run a server, and all servers can talk to each other through federation. You can send messages, make voice/video calls, and share files — all encrypted end-to-end.
Synapse is the reference implementation of a Matrix homeserver, written in Python/Twisted with performance-critical parts in Rust. It is developed and maintained by Element and released under the AGPL license. With over 3,100 GitHub stars and 554 contributors, it is the most widely deployed Matrix homeserver in existence.
Your Matrix ID on a self-hosted Synapse looks like
@you:yourdomain.com— your identity, on your domain, forever.
Why Self-Host Your Own Synapse Server?
Privacy & Data Sovereignty
All your messages, files, and metadata live on your server — not on a third-party's infrastructure. No one can read, sell, or hand over your data without your knowledge.
Federation & Interoperability
A self-hosted Synapse server federates with the entire Matrix network. Your users can communicate with anyone on matrix.org, Element, or any other Matrix-compatible service.
Full Control
You decide who can register, what retention policies apply, which bridges to install (Telegram, WhatsApp, IRC, Slack...), and how resources are allocated.
No Vendor Lock-in
Matrix is an open standard. You can switch clients (Element, FluffyChat, Cinny, etc.) or even migrate to a different homeserver implementation without losing your data.
Cost Efficiency for Teams
For small-to-medium teams, self-hosting on a VPS is dramatically cheaper than paid subscriptions to proprietary tools like Slack or Teams.
Bridges & Bots
Synapse supports a rich ecosystem of bridges that connect your Matrix server to other messaging platforms, letting your team use a single interface for all communications.
Getting Started: Install Synapse with Docker
This guide uses Docker and Nginx on a fresh Ubuntu 22.04 server. You'll need:
- A VPS with at least 2 vCPU, 2 GB RAM (4 GB recommended)
- A domain name pointing to your server IP
- Docker and Docker Compose installed
Step 1 — Point Your Domain
Create an A record for your Matrix domain, e.g.:
matrix.yourdomain.com -> YOUR_SERVER_IP
Step 2 — Install Docker
curl -fsSL https://get.docker.com | sh
sudo usermod -aG docker $USER
Step 3 — Generate Synapse Configuration
mkdir -p ~/synapse && cd ~/synapse
docker run -it --rm \
-v $(pwd)/data:/data \
-e SYNAPSE_SERVER_NAME=matrix.yourdomain.com \
-e SYNAPSE_REPORT_STATS=yes \
matrixdotorg/synapse:latest generate
This creates data/homeserver.yaml — your main configuration file.
Step 4 — Create docker-compose.yml
version: "3"
services:
synapse:
image: matrixdotorg/synapse:latest
container_name: synapse
restart: unless-stopped
volumes:
- ./data:/data
ports:
- "8448:8448"
- "8008:8008"
Start the server:
docker compose up -d
Step 5 — Set Up Nginx Reverse Proxy + TLS
Install Nginx and Certbot:
sudo apt install nginx certbot python3-certbot-nginx -y
Create /etc/nginx/sites-available/matrix:
server {
server_name matrix.yourdomain.com;
location / {
proxy_pass http://localhost:8008;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $host;
client_max_body_size 50M;
}
}
Enable it and get a certificate:
sudo ln -s /etc/nginx/sites-available/matrix /etc/nginx/sites-enabled/
sudo certbot --nginx -d matrix.yourdomain.com
sudo systemctl reload nginx
Step 6 — Create Your Admin User
docker exec -it synapse register_new_matrix_user \
-c /data/homeserver.yaml \
http://localhost:8008
Step 7 — Connect a Client
Open Element Web, click Sign In, change the homeserver to https://matrix.yourdomain.com, and log in with the account you just created.
Your Matrix homeserver is now live and federated with the entire Matrix network!
Recommended netcup VPS Plans for Synapse
netcup offers high-performance, GDPR-compliant VPS hosting in European data centers (Germany, Vienna, Netherlands) at some of the best prices on the market — making them an ideal choice for self-hosting Synapse. All plans include DDoS protection, KVM virtualization, and IPv6.
Coupon codes are one-time use — grab one before they run out! For the latest codes, visit netcup.best.
| Plan | vCPU | RAM | NVMe | Best For | Coupon Codes (1 Month Free) |
|---|---|---|---|---|---|
| VPS 1000 G12 | 4 | 8 GB | 256 GB | Personal / small team up to 20 users | 5799nc17718015262 5799nc17718015261 5799nc17718015260 5799nc17718015265 |
| VPS 2000 G12 | 8 | 16 GB | 512 GB | Medium org up to 100 users | 5800nc17718015232 5800nc17718015231 5800nc17718015230 5800nc17718015235 |
| VPS 4000 G12 | 12 | 32 GB | 1 TB | Large community / federated server | 5801nc17718015212 5801nc17718015211 5801nc17718015210 5801nc17718015215 |
Tips for a Production Synapse Setup
- Use PostgreSQL instead of the default SQLite for any server with more than a handful of users — it dramatically improves performance.
- Enable URL preview caching and configure media storage limits to avoid disk bloat.
- Set up a CAPTCHA (reCAPTCHA or hCaptcha) before enabling open registration to prevent spam bots.
- Host Synapse on a dedicated domain (e.g.,
matrix.yourdomain.com), not on the same domain as other web apps, to minimize XSS attack surface. - Keep Synapse updated — the project releases frequently. Check the upgrade notes before each update.
- Join the community at
#synapse:matrix.orgfor admin help and tips.