Matrix is an open, decentralized messaging protocol that gives you full control over your communications. This guide walks you through self-hosting your own Matrix homeserver as a private, secure alternative to Discord.
Publish date: 2/28/2026
Discord is convenient, but convenience comes at a cost: your messages, metadata, and community data live on someone else's servers. If you've been looking for a way to run your own chat infrastructure without handing your data to a third party, Matrix is worth your attention.
Matrix is an open-source, federated messaging protocol. Unlike Discord, nobody owns the network, anyone can run a homeserver, and users on different servers can still communicate with each other. This guide covers how to self-host a Matrix homeserver using Synapse, on a Linux VPS.
Matrix is a protocol, not just an app. It defines how messages are exchanged between servers, which means the network is decentralized by design. Two people on completely different homeservers can join the same room and chat in real time, similar to how email works across providers.
Discord, on the other hand, is a closed platform. Your data, your communities, and your communication all run through Discord's infrastructure. There's no export, no federation, and no privacy guarantee beyond what their terms of service say.
Matrix gives you:
The most popular Matrix client is Element, which runs on desktop, mobile, and the web. It's a solid Discord-equivalent in terms of UI and features.
Synapse is the most widely deployed Matrix homeserver. It's written in Python and has a reasonable resource footprint for small communities, though it can get memory-hungry at scale.
For a small to mid-size homeserver (up to a few hundred active users), a VPS with at least:
...will get you started comfortably. If you're planning to enable federation with the wider Matrix network, you'll want more headroom, especially RAM.
If you're looking for a good place to host, VPS providers in the Netherlands are a popular choice for privacy-focused projects, thanks to strong data protection laws and well-connected infrastructure.
Before you start, make sure you have:
matrix.yourdomain.com)Port 8448 is used for Matrix federation. If you don't plan to federate with other servers, you can skip that one.
sudo apt update && sudo apt upgrade -y
sudo apt install -y lsb-release wget apt-transport-https
wget -qO /usr/share/keyrings/matrix-org-archive-keyring.gpg https://packages.matrix.org/debian/matrix-org-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/matrix-org-archive-keyring.gpg] https://packages.matrix.org/debian/ $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/matrix-org.list
sudo apt update
sudo apt install matrix-synapse-py3 -y
During installation, you'll be prompted to enter your server name. Use your domain (e.g., yourdomain.com), not a subdomain. This becomes your Matrix identity namespace — users will have IDs like @user:yourdomain.com.
The main config file lives at /etc/matrix-synapse/homeserver.yaml. Open it with your editor of choice and review the key settings:
sudo nano /etc/matrix-synapse/homeserver.yaml
Key settings to check or set:
server_name: your domain (already set during install)public_baseurl: set to https://yourdomain.comregistration_shared_secret: generate a random string here if you want to create users via command lineenable_registration: set to false unless you want open signupsTo generate a secure secret string, you can use:
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | head -c 32
Install Nginx and Certbot:
sudo apt install nginx certbot python3-certbot-nginx -y
Create an Nginx config for your Matrix domain:
sudo nano /etc/nginx/sites-available/matrix
Paste this configuration:
server {
listen 80;
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 the site and get your SSL certificate:
sudo ln -s /etc/nginx/sites-available/matrix /etc/nginx/sites-enabled/
sudo nginx -t && sudo systemctl reload nginx
sudo certbot --nginx -d matrix.yourdomain.com
Certbot will automatically update your Nginx config to redirect HTTP to HTTPS.
sudo systemctl enable matrix-synapse
sudo systemctl start matrix-synapse
sudo systemctl status matrix-synapse
If everything looks good, Synapse is running on port 8008 locally, proxied through Nginx over HTTPS.
register_new_matrix_user -c /etc/matrix-synapse/homeserver.yaml http://localhost:8008
Follow the prompts to set a username and password. Mark this account as an admin.
Federation lets your server communicate with other Matrix homeservers. For this to work, other servers need to be able to reach your server on port 8448, or you need to configure a .well-known delegation so they can find you via port 443.
The simpler approach is the .well-known method. Create a file at https://yourdomain.com/.well-known/matrix/server with:
{
"m.server": "matrix.yourdomain.com:443"
}
Then update your Nginx config to serve this file from your root domain and configure Synapse to listen on port 8448 with a valid TLS certificate. The Matrix federation docs cover this in detail.
If you want a fully private server for internal use only, you can skip federation entirely.
Once your server is running, point Element Web at your homeserver:
https://matrix.yourdomain.comYou can also self-host Element Web itself for a fully independent setup, though using the hosted version at app.element.io connecting to your own homeserver is a reasonable middle ground.
One underrated feature of Matrix is bridging. You can connect your Matrix server to Discord, Slack, Telegram, WhatsApp, and more, letting you read and reply from Element while others stay in their apps.
Popular bridges include:
Each bridge runs as a separate process and registers as an application service on your homeserver. Setup varies per bridge, but they all follow a similar pattern: install, configure, register with Synapse, restart.
A few things worth doing right away:
enable_registration: false)For more on privacy-focused hosting decisions, the best privacy-friendly hosting providers article is worth a read.
Self-hosting a Matrix server takes a bit of setup, but once it's running, you have a messaging platform you fully control. No vendor lock-in, no data harvesting, and you can federate with the rest of the Matrix network or keep things completely private.
Thanks for reading! If you're looking for a reliable place to run your homeserver, QDE VPS hosting offers high-performance plans with NVMe storage and 10 Gbps uplinks, hosted in the Netherlands — a solid match for privacy-first projects.
Ready to get started or want to talk through your setup? Contact our team and we'll help you find the right plan.
Discord is a closed platform where all data is stored on Discord's servers. Matrix is an open, federated protocol — you run your own server and own your data. The two aren't interchangeable, but Matrix can bridge into Discord if you still need access to Discord communities.
Yes, Matrix supports end-to-end encryption in private rooms and direct messages using the Olm and Megolm cryptographic protocols. Group rooms can also be encrypted, though federation and encryption together can introduce some complexity.
It depends on your user count. A small homeserver for personal or team use can run comfortably on a $5–15/month VPS. Synapse's memory usage scales with active users and room history, so larger communities will need more resources.
There's no direct migration tool, but you can use a Discord bridge to run both in parallel while you transition. Over time, communities can move their activity to Matrix rooms entirely.
Yes. Your server name (and therefore all user IDs) is tied to a domain. You can use a subdomain like matrix.yourdomain.com for the actual server while keeping your root domain clean for identity purposes.
Element Web is a static site you can serve from the same VPS using Nginx. Clone the Element Web repository, configure config.json to point to your homeserver, and serve the build directory. It's straightforward to set up alongside Synapse.
No. Conduit and Dendrite are lighter alternatives written in Rust and Go respectively. Conduit in particular is a good choice for small personal servers where resource efficiency matters more than feature completeness.