Prerequisites
RamNode VPS plans are a solid fit for a personal or small-team Synapse deployment. The $4/month plan handles a low-traffic homeserver, while the $8/month plan is recommended if you plan to bridge external platforms or serve more than a handful of users.
Minimum Recommended Specs
| Resource | Minimum | Recommended |
|---|---|---|
| vCPU | 1 | 2 |
| RAM | 512 MB | 1 GB |
| Disk | 10 GB SSD | 20 GB SSD |
| Bandwidth | 500 GB/mo | 1 TB/mo |
Additional Requirements
- A RamNode VPS running Ubuntu 22.04 LTS (recommended)
- A domain name pointed at your VPS IP (e.g.,
matrix.yourdomain.com) - Root or sudo access
- Basic familiarity with the Linux command line
Provision Your RamNode VPS
Log into the RamNode client area, deploy a new VPS, and select Ubuntu 22.04 LTS as your OS. Once your VPS is active, connect via SSH:
ssh root@YOUR_VPS_IP
apt update && apt upgrade -yConfigure DNS
Set up DNS records so your domain resolves to your VPS. Log into your DNS provider and create the following:
| Type | Name | Value | TTL |
|---|---|---|---|
| A | matrix | YOUR_VPS_IP | 300 |
| A | element | YOUR_VPS_IP | 300 |
For Matrix federation to work correctly, you also need an SRV record or a .well-known delegation. The .well-known method is easier and is covered in Step 8. Wait a few minutes for DNS propagation before proceeding.
Install Dependencies
Install Nginx, Certbot, and PostgreSQL. Synapse works with SQLite out of the box, but PostgreSQL is strongly recommended for anything beyond local testing.
apt install -y nginx certbot python3-certbot-nginx postgresql postgresql-contribInstall Matrix Synapse
Matrix.org maintains an official Debian/Ubuntu repository. Add it and install Synapse:
apt install -y lsb-release wget apt-transport-https
wget -O /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" \
| tee /etc/apt/sources.list.d/matrix-org.list
apt update
apt install -y matrix-synapse-py3Important: During installation, you will be prompted for your server name. Enter your root domain (not the subdomain), for example: yourdomain.com. This becomes your Matrix user ID domain — users will have IDs like @username:yourdomain.com. This cannot be changed later.
Configure PostgreSQL
Synapse defaults to SQLite, which is not suitable for production. Switch to PostgreSQL now before generating any data.
sudo -u postgres psqlCREATE USER synapse WITH PASSWORD 'your_strong_password';
CREATE DATABASE synapse
ENCODING 'UTF8'
LC_COLLATE='C'
LC_CTYPE='C'
TEMPLATE=template0
OWNER synapse;
\qNow update the Synapse config to use PostgreSQL:
database:
name: psycopg2
args:
user: synapse
password: your_strong_password
database: synapse
host: localhost
cp_min: 5
cp_max: 10Important: Replace your_strong_password with a strong, unique password. Store this securely.
Configure Synapse
Edit /etc/matrix-synapse/homeserver.yaml to configure key settings.
Bind Address and Port
listeners:
- port: 8008
tls: false
type: http
x_forwarded: true
bind_addresses: ['127.0.0.1']
resources:
- names: [client, federation]
compress: falseRegistration
Disable open registration unless you want anyone to sign up on your server:
enable_registration: falseTo create accounts manually, use the register_new_matrix_user command (covered in Step 12).
Media Storage
Make sure your VPS has enough disk headroom for media uploads if you plan to share files or images.
media_store_path: /var/lib/matrix-synapse/media
max_upload_size: 50MLogging
log_config: /etc/matrix-synapse/log.yamlSet Up .well-known Federation Delegation
This lets you use yourdomain.com as your server name while actually running Synapse at matrix.yourdomain.com.
mkdir -p /var/www/yourdomain.com/.well-known/matrixClient delegation file
{
"m.homeserver": {
"base_url": "https://matrix.yourdomain.com"
}
}Server delegation file
{
"m.server": "matrix.yourdomain.com:443"
}Configure Nginx
Create an Nginx server block to reverse proxy to Synapse and serve your .well-known files.
server {
listen 80;
server_name matrix.yourdomain.com yourdomain.com;
# .well-known delegation for root domain
location /.well-known/matrix {
root /var/www/yourdomain.com;
add_header Access-Control-Allow-Origin *;
add_header Content-Type application/json;
}
# Proxy to Synapse
location ~* ^(\_matrix|\_synapse\/client) {
proxy_pass http://127.0.0.1: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;
proxy_http_version 1.1;
}
}ln -s /etc/nginx/sites-available/matrix /etc/nginx/sites-enabled/matrix
nginx -t
systemctl reload nginxObtain TLS Certificates
Use Certbot to provision Let's Encrypt certificates. Certbot will automatically update your Nginx config with SSL directives and set up auto-renewal.
certbot --nginx -d matrix.yourdomain.com -d yourdomain.comcertbot renew --dry-runStart Synapse
systemctl enable matrix-synapse
systemctl start matrix-synapse
systemctl status matrix-synapsejournalctl -u matrix-synapse -fCreate Your First User
Since open registration is disabled, create your admin account from the command line:
register_new_matrix_user -c /etc/matrix-synapse/homeserver.yaml http://localhost:8008You will be prompted for a username, password, and whether to make the account an admin. Choose yes for admin.
Verify Federation
Use the Matrix Federation Tester to confirm your server is federating correctly:
https://federationtester.matrix.org/#yourdomain.comA successful result shows all green checks for DNS, well-known, TLS, and federation.
(Optional) Install Element Web Client
Element is the most popular Matrix web client. You can host it on the same VPS:
apt install -y unzip
cd /var/www
wget https://github.com/element-hq/element-web/releases/latest/download/element-latest.tar.gz
tar -xzf element-latest.tar.gz
mv element-* element
cp element/config.sample.json element/config.jsonConfigure Element
Edit element/config.json and point it at your homeserver:
{
"default_server_config": {
"m.homeserver": {
"base_url": "https://matrix.yourdomain.com",
"server_name": "yourdomain.com"
}
}
}Element Nginx Config
server {
listen 443 ssl;
server_name element.yourdomain.com;
ssl_certificate /etc/letsencrypt/live/matrix.yourdomain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/matrix.yourdomain.com/privkey.pem;
root /var/www/element;
index index.html;
location / {
try_files $uri $uri/ =404;
}
}certbot --nginx -d element.yourdomain.comMaintenance
Check Disk Usage
Synapse caches a lot of media. Monitor usage regularly:
df -h
du -sh /var/lib/matrix-synapse/mediaPurge Old Remote Media
curl -X POST "https://matrix.yourdomain.com/_synapse/admin/v1/purge_media_cache?before_ts=$(date -d '30 days ago' +%s%3N)" \
-H "Authorization: Bearer YOUR_ADMIN_TOKEN"Update Synapse
apt update && apt upgrade matrix-synapse-py3
systemctl restart matrix-synapseBackup Database
pg_dump -U synapse synapse | gzip > /root/synapse-backup-$(date +%Y%m%d).sql.gzTroubleshooting
| Issue | Solution |
|---|---|
| Synapse fails to start | Check journalctl -u matrix-synapse -f for errors |
| Federation not working | Verify .well-known files return correct JSON at your domain |
| Disk full | Purge old media cache, check PostgreSQL WAL files |
| High memory usage | Tune caches.global_factor in homeserver.yaml (default 0.5, lower to reduce RAM) |
| TLS errors | Re-run certbot renew and ensure Nginx config references correct cert paths |
Matrix Synapse Deployed Successfully!
You now have a self-hosted Matrix Synapse homeserver running on a RamNode VPS, with PostgreSQL for storage, Nginx as a reverse proxy, and Let's Encrypt TLS. Your users will have Matrix IDs in the format @username:yourdomain.com and can connect from any Matrix-compatible client including Element, FluffyChat, or Cinny.
For further configuration including setting up bridges to Slack, Discord, or Telegram, refer to the Matrix Bridges documentation.
