Secure Communication Guide

    Deploy Matrix Synapse

    Matrix Synapse is an open-source homeserver for the Matrix protocol — a decentralized, end-to-end encrypted messaging network. Self-host your own secure communication platform on RamNode's reliable VPS hosting.

    End-to-End Encryption
    Federation
    Data Sovereignty
    Element Web Client
    1

    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

    ResourceMinimumRecommended
    vCPU12
    RAM512 MB1 GB
    Disk10 GB SSD20 GB SSD
    Bandwidth500 GB/mo1 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
    2

    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:

    Connect and update
    ssh root@YOUR_VPS_IP
    
    apt update && apt upgrade -y
    3

    Configure DNS

    Set up DNS records so your domain resolves to your VPS. Log into your DNS provider and create the following:

    TypeNameValueTTL
    AmatrixYOUR_VPS_IP300
    AelementYOUR_VPS_IP300

    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.

    4

    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.

    Install Nginx, Certbot, and PostgreSQL
    apt install -y nginx certbot python3-certbot-nginx postgresql postgresql-contrib
    5

    Install Matrix Synapse

    Matrix.org maintains an official Debian/Ubuntu repository. Add it and install Synapse:

    Add Matrix repository and install
    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-py3

    Important: 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.

    6

    Configure PostgreSQL

    Synapse defaults to SQLite, which is not suitable for production. Switch to PostgreSQL now before generating any data.

    Open PostgreSQL shell
    sudo -u postgres psql
    Create database and user (inside psql)
    CREATE USER synapse WITH PASSWORD 'your_strong_password';
    CREATE DATABASE synapse
      ENCODING 'UTF8'
      LC_COLLATE='C'
      LC_CTYPE='C'
      TEMPLATE=template0
      OWNER synapse;
    \q

    Now update the Synapse config to use PostgreSQL:

    Database block in /etc/matrix-synapse/homeserver.yaml
    database:
      name: psycopg2
      args:
        user: synapse
        password: your_strong_password
        database: synapse
        host: localhost
        cp_min: 5
        cp_max: 10

    Important: Replace your_strong_password with a strong, unique password. Store this securely.

    7

    Configure Synapse

    Edit /etc/matrix-synapse/homeserver.yaml to configure key settings.

    Bind Address and Port

    Listener configuration
    listeners:
      - port: 8008
        tls: false
        type: http
        x_forwarded: true
        bind_addresses: ['127.0.0.1']
        resources:
          - names: [client, federation]
            compress: false

    Registration

    Disable open registration unless you want anyone to sign up on your server:

    Disable open registration
    enable_registration: false

    To 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 settings
    media_store_path: /var/lib/matrix-synapse/media
    max_upload_size: 50M

    Logging

    Log config
    log_config: /etc/matrix-synapse/log.yaml
    8

    Set Up .well-known Federation Delegation

    This lets you use yourdomain.com as your server name while actually running Synapse at matrix.yourdomain.com.

    Create delegation directories
    mkdir -p /var/www/yourdomain.com/.well-known/matrix

    Client delegation file

    /var/www/yourdomain.com/.well-known/matrix/client
    {
      "m.homeserver": {
        "base_url": "https://matrix.yourdomain.com"
      }
    }

    Server delegation file

    /var/www/yourdomain.com/.well-known/matrix/server
    {
      "m.server": "matrix.yourdomain.com:443"
    }
    9

    Configure Nginx

    Create an Nginx server block to reverse proxy to Synapse and serve your .well-known files.

    /etc/nginx/sites-available/matrix
    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;
        }
    }
    Enable the site
    ln -s /etc/nginx/sites-available/matrix /etc/nginx/sites-enabled/matrix
    nginx -t
    systemctl reload nginx
    10

    Obtain 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.

    Obtain certificates
    certbot --nginx -d matrix.yourdomain.com -d yourdomain.com
    Test renewal
    certbot renew --dry-run
    11

    Start Synapse

    Enable and start Matrix Synapse
    systemctl enable matrix-synapse
    systemctl start matrix-synapse
    systemctl status matrix-synapse
    Check logs if needed
    journalctl -u matrix-synapse -f
    12

    Create Your First User

    Since open registration is disabled, create your admin account from the command line:

    Register admin user
    register_new_matrix_user -c /etc/matrix-synapse/homeserver.yaml http://localhost:8008

    You will be prompted for a username, password, and whether to make the account an admin. Choose yes for admin.

    13

    Verify Federation

    Use the Matrix Federation Tester to confirm your server is federating correctly:

    Federation tester
    https://federationtester.matrix.org/#yourdomain.com

    A successful result shows all green checks for DNS, well-known, TLS, and federation.

    14

    (Optional) Install Element Web Client

    Element is the most popular Matrix web client. You can host it on the same VPS:

    Download and extract Element Web
    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.json

    Configure Element

    Edit element/config.json and point it at your homeserver:

    /var/www/element/config.json
    {
      "default_server_config": {
        "m.homeserver": {
          "base_url": "https://matrix.yourdomain.com",
          "server_name": "yourdomain.com"
        }
      }
    }

    Element Nginx Config

    /etc/nginx/sites-available/element
    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;
        }
    }
    Enable and get certificate for Element
    certbot --nginx -d element.yourdomain.com
    15

    Maintenance

    Check Disk Usage

    Synapse caches a lot of media. Monitor usage regularly:

    Monitor disk usage
    df -h
    du -sh /var/lib/matrix-synapse/media

    Purge Old Remote Media

    Purge cached remote media older than 30 days
    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

    Update Matrix Synapse
    apt update && apt upgrade matrix-synapse-py3
    systemctl restart matrix-synapse

    Backup Database

    Backup with pg_dump
    pg_dump -U synapse synapse | gzip > /root/synapse-backup-$(date +%Y%m%d).sql.gz

    Troubleshooting

    IssueSolution
    Synapse fails to startCheck journalctl -u matrix-synapse -f for errors
    Federation not workingVerify .well-known files return correct JSON at your domain
    Disk fullPurge old media cache, check PostgreSQL WAL files
    High memory usageTune caches.global_factor in homeserver.yaml (default 0.5, lower to reduce RAM)
    TLS errorsRe-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.