Independent testing Updated April 2026 387 self-hosting guides 5 VPS providers tested

guide

How to Self-Host HedgeDoc on a VPS (Complete Guide)

Learn how to self-host HedgeDoc on a VPS with a step-by-step guide covering installation, configuration, and securing HedgeDoc for reliable daily use.

Introduction

HedgeDoc is a collaborative markdown editor that allows multiple users to edit documents in real-time. Itโ€™s often used for note-taking and documentation among teams. Self-hosting HedgeDoc on a Virtual Private Server (VPS) gives you complete control over your data and ensures privacy. In this guide, weโ€™ll walk you through the steps to install HedgeDoc on a VPS using Docker.

Prerequisites

  1. A VPS: Choose a suitable VPS provider. Hereโ€™s a quick comparison of some popular options:
ProviderMonthly PriceRAMDisk SpaceCPU
Contabo VPS5.99 EUR4 GB50 GB2 Cores
Hetzner Cloud4.15 EUR2 GB20 GB1 Core
DigitalOcean6 USD2 GB1 vCPU1 Core
Vultr6 USD2 GB1 vCPU1 Core
Linode (Akamai)5 USD2 GB1 vCPU1 Core

For detailed comparisons of various VPS providers, check our full VPS comparison.

  1. SSH Access: Ensure you can access your VPS via SSH.

  2. Docker and Docker Compose: Ensure that both Docker and Docker Compose are installed on your VPS. You can install them using the following commands:

    sudo apt update
    sudo apt install -y docker.io docker-compose

Step 1: Setting Up the HedgeDoc Environment

  1. Create a directory for HedgeDoc:

    mkdir ~/hedgedoc
    cd ~/hedgedoc
  2. Create a docker-compose.yml file in the hedgedoc directory. Add the following configuration to set up HedgeDoc with PostgreSQL as the database:

    version: '3.1'
    
    services:
      hedgedoc:
        image: hedgedoc/hedgedoc:latest
        environment:
          - CMD_URI=https://your-domain.com
          - DB_TYPE=postgres
          - DB_HOST=db
          - DB_PORT=5432
          - DB_USER=hedgedoc
          - DB_PASS=hedgedoc_password
          - DB_NAME=hedgedoc
        ports:
          - '3000:3000'
        depends_on:
          - db
    
      db:
        image: postgres:latest
        environment:
          - POSTGRES_USER=hedgedoc
          - POSTGRES_PASSWORD=hedgedoc_password
          - POSTGRES_DB=hedgedoc
        volumes:
          - db_data:/var/lib/postgresql/data
    
    volumes:
      db_data:
  3. Replace your-domain.com with the actual domain you will use to access HedgeDoc.

Step 2: Running HedgeDoc

  1. Start the HedgeDoc application using Docker Compose:

    docker-compose up -d
  2. Verify that HedgeDoc is running correctly by checking the logs:

    docker-compose logs -f
  3. By default, HedgeDoc will be accessible at http://your-server-ip:3000. Youโ€™ll want to set up a reverse proxy for a production environment.

Step 3: Setting Up a Reverse Proxy with Nginx

  1. Install Nginx:

    sudo apt install -y nginx
  2. Create a new configuration file for HedgeDoc:

    sudo nano /etc/nginx/sites-available/hedgedoc
  3. Add the following configuration:

    server {
        listen 80;
        server_name your-domain.com;
    
        location / {
            proxy_pass http://localhost:3000;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
        }
    }
  4. Enable the configuration:

    sudo ln -s /etc/nginx/sites-available/hedgedoc /etc/nginx/sites-enabled/
    sudo nginx -t
    sudo systemctl restart nginx

Step 4: Securing HedgeDoc with SSL

  1. To secure your HedgeDoc instance, you can use Letโ€™s Encrypt. Install Certbot:

    sudo apt install -y certbot python3-certbot-nginx
  2. Run Certbot to get SSL for your domain:

    sudo certbot --nginx -d your-domain.com

Frequently Asked Questions

1. What are the benefits of self-hosting HedgeDoc?

Self-hosting HedgeDoc grants you unparalleled control over your data and privacy. Unlike cloud-based options, when you self-host, you manage security updates and customizations according to your needs. This setup is crucial for developers and homelabbers who require compliance with specific data handling processes or want to integrate HedgeDoc into more extensive systems seamlessly.

2. Can I run HedgeDoc on low-spec VPS?

Yes, HedgeDoc can run efficiently on a low-spec VPS, provided that it meets the system requirements. For basic operations, a VPS with 2 GB of RAM and minimal disk space suffices. However, for larger instances or collaborations with multiple users, consider a VPS with at least 4 GB RAM and 50 GB of disk space to ensure smooth performance. The pricing structure of providers like Contabo and Hetzner can meet this need affordably.

3. How do I update my HedgeDoc installation?

Updating HedgeDoc is straightforward due to its Docker setup. You can pull the latest image and restart the containers. Hereโ€™s the command to do that:

docker-compose pull
docker-compose up -d

After executing these commands, you should regularly check the HedgeDoc release notes for any changes or required migration steps to ensure seamless operation. You can refer to the HedgeDoc documentation for specific details on version updates.

Conclusion

Self-hosting HedgeDoc on a VPS allows you to benefit from a powerful markdown editor while retaining control over your environment. With the setup steps outlined above, you should now be able to install, configure, and secure HedgeDoc effectively. Enjoy real-time collaboration without compromising on privacy or data integrity.