Technology Encyclopedia Home >Set Up a Self-Hosted Obsidian Sync Alternative on a VPS — Private Knowledge Base with Real-Time Sync

Set Up a Self-Hosted Obsidian Sync Alternative on a VPS — Private Knowledge Base with Real-Time Sync

I use Obsidian for notes, and my vault has grown into something I genuinely depend on — research, project notes, writing drafts. Keeping it synced across my laptop, desktop, and phone became important enough that I looked at the official sync service.

The price made sense for a few months, but for something this central to my workflow, I'd rather own the infrastructure. Obsidian works with plain Markdown files, so the sync layer is replaceable.

This guide covers two approaches: the simple one (Syncthing for desktop-to-desktop) and the full one (CouchDB + Obsidian LiveSync for real-time sync including mobile). I'll help you decide which fits your situation.

This guide covers two approaches: Syncthing (the simplest, for file sync without a server component) and Obsidian LiveSync (which uses a CouchDB backend on your server for real-time sync and conflict resolution).

For most people, the self-hosted CouchDB + Obsidian LiveSync approach gives you the closest experience to official Obsidian Sync at a fraction of the cost.

I sync my Obsidian vault via a CouchDB instance on Tencent Cloud Lighthouse. The entry-level plan handles CouchDB for a personal vault easily — CouchDB is not resource-intensive. What makes Lighthouse work well as a sync relay: the server runs continuously and reliably, so changes sync between your devices whenever they connect — even if you open Obsidian on mobile at 2am, the latest notes are there. The static public IP means your CouchDB endpoint URL stays consistent permanently, and OrcaTerm lets you check sync status or restart CouchDB from any browser.


Table of Contents

  1. Two Sync Approaches Compared
  2. What You Need
  3. Part 1: Deploy CouchDB with Docker
  4. Part 2: Configure Nginx with HTTPS
  5. Part 3: Configure Obsidian LiveSync Plugin
  6. Part 4: Connect Multiple Devices
  7. Part 5: Obsidian + Syncthing (Simpler Alternative)
  8. The Thing That Tripped Me Up
  9. Troubleshooting
  10. Summary

  • Key Takeaways
  • Use the appropriate Lighthouse application image to skip manual installation steps where available
  • Lighthouse snapshots provide one-click full-server backup before major changes
  • OrcaTerm browser terminal lets you manage the server from any device
  • CBS cloud disk expansion handles growing storage needs without server migration
  • Console-level firewall + UFW = two independent protection layers

Two Sync Approaches Compared {#approaches}

Feature CouchDB + LiveSync Syncthing
Conflict resolution Smart merge (plugin handles) Basic (creates conflict files)
Mobile sync Yes (iOS/Android) Yes
End-to-end encryption Optional (plugin supports it) Optional
Real-time sync Yes Near-real-time
Server requirement CouchDB None (P2P)
Setup complexity Moderate Simple
Works without internet No (needs server) Yes (LAN sync)

Recommendation: If you use multiple devices including mobile, use LiveSync + CouchDB. If you only sync between desktop machines, Syncthing is simpler.


What You Need {#prerequisites}

Requirement Details
Server Ubuntu 22.04, 1 GB+ RAM
Docker Installed
Obsidian Installed on your devices
Domain For HTTPS access (required for mobile)

Part 1: Deploy CouchDB with Docker {#part-1}

1.1 — Install Docker

curl -fsSL https://get.docker.com | sh
sudo systemctl enable docker

1.2 — Create CouchDB Container

mkdir -p /opt/couchdb/data

docker run -d \
  --name couchdb \
  --restart=always \
  -p 127.0.0.1:5984:5984 \
  -e COUCHDB_USER=admin \
  -e COUCHDB_PASSWORD=your-secure-password \
  -v /opt/couchdb/data:/opt/couchdb/data \
  couchdb:3

1.3 — Initialize CouchDB (Required)

CouchDB needs to be initialized in single-node mode:

curl -X POST http://admin:your-secure-password@localhost:5984/_cluster_setup \
  -H "Content-Type: application/json" \
  -d '{"action": "finish_cluster"}'

Expected response: {"ok":true}

1.4 — Create a Database for Obsidian

curl -X PUT http://admin:your-secure-password@localhost:5984/obsidian-vault

Verify:

curl http://admin:your-secure-password@localhost:5984/_all_dbs
# Should show: ["_replicator","_users","obsidian-vault"]

Part 2: Configure Nginx with HTTPS {#part-2}

CouchDB needs to be accessible via HTTPS for mobile Obsidian clients.

sudo apt install -y nginx certbot python3-certbot-nginx
sudo nano /etc/nginx/sites-available/couchdb
server {
    listen 80;
    server_name couch.yourdomain.com;

    location / {
        proxy_pass http://localhost:5984;
        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;
        
        # CouchDB requires these headers for CORS
        add_header 'Access-Control-Allow-Origin' '*' always;
        add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always;
        add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type' always;
        
        if ($request_method = 'OPTIONS') {
            return 204;
        }
    }
}
sudo ln -s /etc/nginx/sites-available/couchdb /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx
sudo certbot --nginx -d couch.yourdomain.com

Enable CORS in CouchDB

curl -X PUT http://admin:your-secure-password@localhost:5984/_node/nonode@nohost/_config/httpd/enable_cors \
  -d '"true"'

curl -X PUT http://admin:your-secure-password@localhost:5984/_node/nonode@nohost/_config/cors/origins \
  -d '"*"'

curl -X PUT http://admin:your-secure-password@localhost:5984/_node/nonode@nohost/_config/cors/credentials \
  -d '"true"'

curl -X PUT http://admin:your-secure-password@localhost:5984/_node/nonode@nohost/_config/cors/methods \
  -d '"GET, PUT, POST, HEAD, DELETE"'

curl -X PUT http://admin:your-secure-password@localhost:5984/_node/nonode@nohost/_config/cors/headers \
  -d '"accept, authorization, content-type, origin, referer"'

Part 3: Configure Obsidian LiveSync Plugin {#part-3}

3.1 — Install the Plugin

In Obsidian:

  1. Settings → Community Plugins → Browse
  2. Search for "Self-hosted LiveSync"
  3. Install and enable it

3.2 — Configure the Connection

Go to Settings → Self-hosted LiveSync:

  • CouchDB Remote URL: https://couch.yourdomain.com
  • Username: admin
  • Password: your CouchDB password
  • Database Name: obsidian-vault

Click Test — you should see a successful connection.

3.3 — Configure Sync Settings

Recommended settings for personal use:

  • Sync mode: LiveSync (real-time)
  • Batch save: enable (reduces unnecessary syncs)
  • Chunk size: 50 (good default)
  • End-to-end encryption: Optional — if enabled, generate and save the passphrase securely

Click Apply and then Start Sync.

Your vault starts syncing. First sync uploads all notes to CouchDB.


Part 4: Connect Multiple Devices {#part-4}

On Each Additional Device

  1. Install Obsidian
  2. Create or open a vault (can be empty)
  3. Install Self-hosted LiveSync plugin
  4. Configure with the same CouchDB settings
  5. Click Start Sync

The plugin downloads all notes from CouchDB. Your vault is now synchronized.

Mobile (iOS/Android)

Same process: install Obsidian mobile, install LiveSync plugin, enter CouchDB settings.

Note for iOS: Obsidian on iOS requires using HTTPS with a valid certificate. The Nginx + Certbot setup above handles this.


Part 5: Obsidian + Syncthing (Simpler Alternative) {#part-5}

If you prefer simplicity and don't need mobile sync, Syncthing works well for desktop-to-desktop vault sync.

Install Syncthing on your server (covered in guide #72), then:

  1. On each computer, open Syncthing
  2. Add a shared folder pointing to your Obsidian vault location
  3. Connect each device to the server as a peer
  4. Share the vault folder across all devices

Advantages: No CouchDB, no plugin, syncs plain files.
Limitations: Less robust conflict handling; mobile sync is more complex.

For pure desktop sync, Syncthing is the simpler and more reliable choice.


The Thing That Tripped Me Up {#gotcha}

After setting up CouchDB and configuring LiveSync, the plugin showed "Connected" but notes weren't appearing on my second device.

The issue: I'd created the CouchDB database but hadn't properly initialized the single-node cluster. CouchDB in Docker requires the finish_cluster API call to be ready for replication — without it, database operations succeed but replication doesn't work.

Also, the plugin kept showing a "400 Bad Request" for certain requests, which turned out to be a CORS configuration issue. My Nginx config wasn't sending CORS headers for 401 (authentication required) responses.

The fix for CORS on auth responses:

location / {
    proxy_pass http://localhost:5984;
    
    # Must add headers to ALL responses including 401/403
    add_header 'Access-Control-Allow-Origin' '*' always;
    add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type, Accept' always;
    add_header 'Access-Control-Allow-Methods' 'GET, PUT, POST, HEAD, DELETE, OPTIONS' always;
    add_header 'Access-Control-Allow-Credentials' 'true' always;

    if ($request_method = 'OPTIONS') {
        return 204;
    }
    
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-Proto $scheme;
}

The key is always at the end of add_header directives — without it, Nginx only adds headers to 200/304 responses, not error responses.


Troubleshooting {#troubleshooting}

Issue Likely Cause Fix
"Connection failed" in plugin Wrong URL or credentials Test URL directly: curl https://couch.yourdomain.com
Notes not syncing Cluster not initialized Run finish_cluster API call
CORS errors in browser Missing CORS headers Add always to add_header in Nginx
Sync conflicts Same note edited on two devices LiveSync merges automatically; check plugin settings
Mobile can't connect Self-signed cert Use Let's Encrypt (Certbot) — not self-signed
CouchDB container stops Out of memory Upgrade to 2 GB RAM
Database not found Wrong database name Verify database exists: curl .../obsidian-vault

Summary {#verdict}

What you built:

  • CouchDB server running on your cloud VPS
  • HTTPS endpoint via Nginx with Let's Encrypt
  • Obsidian LiveSync configured for real-time vault sync
  • Multi-device support: desktop + mobile
  • End-to-end encryption option for sensitive notes

Monthly cost: the price of your cloud server (~$5–6/month). Compared to Obsidian Sync at $8–16/month, you save money and gain complete data ownership.

Frequently Asked Questions {#faq}

What data does self-hosted Obsidian sync protect compared to cloud services?
Your content — notes, documents, calendar events, tasks — is stored on your server and never sent to a third party's infrastructure. This matters for sensitive personal or professional information.

Can I collaborate with others on a self-hosted Obsidian sync instance?
Most productivity tools support multiple users. The number of users depends on the tool and your server resources. Check the guide's prerequisites for per-user resource estimates.

How do I access self-hosted Obsidian sync from mobile devices?
Install the official mobile app and configure it to connect to your server URL instead of the default cloud service. The setup is typically done in the app's server settings.

What happens to my data if the server goes down?
Data on the server is preserved. You won't have access until the server is restored, but data isn't lost. Lighthouse snapshots provide backup and quick recovery.

How do I keep the application updated?
Update procedures vary by application. Container-based apps (docker compose pull) are typically straightforward. The guide includes update instructions specific to the application.

👉 Get started with Tencent Cloud Lighthouse
👉 View current pricing and launch promotions
👉 Explore all active deals and offers