How to Self-Host Docmost on a VPS (2026 Guide)
Docmost is an open-source collaborative wiki and documentation platform. Self-hosting it on a VPS gives you complete data ownership, a custom domain, and no per-seat fees. This guide covers the full setup from a fresh Ubuntu VPS to a running Docmost instance with SSL and Nginx.
Prerequisites
Before starting, you need:
- A VPS running Ubuntu 22.04 or 24.04 (at least 1 vCPU, 2GB RAM recommended)
- A domain or subdomain pointed at your VPS IP (e.g.,
docs.yourdomain.com) - Root or sudo access to the server
- Docker and Docker Compose installed
Recommended VPS providers:
- Hetzner Cloud โ โฌ4.15/mo, 2 vCPU, 4GB RAM (best value)
- Contabo VPS โ โฌ5.99/mo, 4 vCPU, 8GB RAM, 200GB NVMe
- DigitalOcean โ $6/mo, beginner-friendly
Step 1: Provision Your VPS
Spin up a fresh Ubuntu 22.04 VPS. SSH in as root:
ssh root@your-server-ip
Create a non-root user with sudo privileges (recommended):
adduser deploy
usermod -aG sudo deploy
Step 2: Install Docker and Docker Compose
# Update system
apt update && apt upgrade -y
# Install Docker
curl -fsSL https://get.docker.com | sh
# Add your user to the docker group
usermod -aG docker deploy
# Verify installation
docker --version
docker compose version
Log out and back in for group changes to take effect.
Step 3: Create the Docmost Directory
mkdir -p /opt/docmost
cd /opt/docmost
Step 4: Write the Docker Compose File
Create /opt/docmost/docker-compose.yml:
version: '3'
services:
docmost:
image: docmost/docmost:latest
ports:
- "3000:3000"
environment:
DATABASE_URL: postgresql://docmost:password@db:5432/docmost
REDIS_URL: redis://redis:6379
depends_on:
- db
- redis
restart: unless-stopped
db:
image: postgres:16
environment:
POSTGRES_USER: docmost
POSTGRES_PASSWORD: password
POSTGRES_DB: docmost
volumes:
- pg_data:/var/lib/postgresql/data
restart: unless-stopped
redis:
image: redis:7
volumes:
- redis_data:/data
restart: unless-stopped
volumes:
pg_data:
redis_data:
Security note: Replace
passwordwith a strong, randomly generated password before deploying.
Step 5: Start Docmost
cd /opt/docmost
docker compose up -d
Check that all containers are running:
docker compose ps
You should see docmost, db, and redis all in running state. Check logs if something fails:
docker compose logs docmost
Step 6: Install and Configure Nginx
apt install nginx -y
Create /etc/nginx/sites-available/docmost:
server {
listen 80;
server_name docs.yourdomain.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name docs.yourdomain.com;
ssl_certificate /etc/letsencrypt/live/docs.yourdomain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/docs.yourdomain.com/privkey.pem;
client_max_body_size 100M;
location / {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
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;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 86400;
}
}
Enable the site:
ln -s /etc/nginx/sites-available/docmost /etc/nginx/sites-enabled/
nginx -t
systemctl reload nginx
Step 7: Obtain SSL Certificate
apt install certbot python3-certbot-nginx -y
certbot --nginx -d docs.yourdomain.com
Follow the prompts. Certbot will automatically update your Nginx config with the certificate paths and set up auto-renewal.
Step 8: Configure Firewall
ufw allow OpenSSH
ufw allow 'Nginx Full'
ufw enable
Do not expose port 3000 directly โ all traffic should flow through Nginx.
Step 9: First Login and Workspace Setup
- Open
https://docs.yourdomain.comin your browser - You will see the Docmost setup wizard on first visit
- Create your admin account (email + password)
- Name your workspace
- Create your first space (e.g., โEngineeringโ, โProductโ, โHRโ)
- Invite team members via the Settings panel
Updating Docmost
To pull the latest image and restart:
cd /opt/docmost
docker compose pull
docker compose up -d
Backup Strategy
Back up PostgreSQL data regularly:
docker exec docmost-db-1 pg_dump -U docmost docmost > backup_$(date +%Y%m%d).sql
Also back up the Docker volume at /var/lib/docker/volumes/docmost_pg_data.
Troubleshooting
| Issue | Fix |
|---|---|
| Containers not starting | Check docker compose logs for errors |
| 502 Bad Gateway | Docmost may still be initializing โ wait 30s and retry |
| WebSocket errors | Ensure Upgrade and Connection headers are in Nginx config |
| DB connection refused | Check DATABASE_URL matches Postgres container credentials |
Next Steps
- Set up SMTP in Docmost settings for email notifications
- Configure OIDC/SSO if your team uses an identity provider
- Enable automatic Docker volume snapshots via your VPS provider
For VPS provider comparisons, see selfhostvps.com/en/best/.