How to Self-Host NocoDB on a VPS with PostgreSQL and HTTPS

By James Wilson | Last updated on November 23, 2026

Learning how to self-host NocoDB on your own Linux VPS gives your team an open-source Airtable alternative without per-seat SaaS fees or row-count limits. NocoDB turns any relational database into a fast collaborative spreadsheet UI with kanban boards, forms, webhooks, and a full REST API.

While NocoDB can start quickly on embedded SQLite for local testing, production teams should pair it with PostgreSQL for concurrent multi-user writes, reliable backups, and cleaner scaling—especially when deployed behind an HTTPS reverse proxy like Caddy or Nginx.

Whether you run self-managed VPS hosting or fully managed VPS hosting with Aveshost, this guide walks through deploying NocoDB with Docker Compose, PostgreSQL 16, automatic Let’s Encrypt HTTPS, and essential security hardening.

Why Pair NocoDB with PostgreSQL and a Reverse Proxy

Out of the box, NocoDB stores metadata in SQLite when no external database is configured. For solo experiments that works fine, but as soon as multiple teammates edit views, trigger webhooks, or upload attachments simultaneously, PostgreSQL eliminates write-lock contention (see our SQLite vs PostgreSQL on a VPS comparison).

Separating storage into two layers also makes upgrades safer: PostgreSQL holds your workspace metadata, table schemas, and user permissions, while the nocodb_data Docker volume mounted at /usr/app/data stores uploaded file attachments and runtime state. You can recreate or upgrade the NocoDB container anytime without touching your relational data.

Binding NocoDB strictly to 127.0.0.1:8080 and placing Caddy or Nginx in front of it keeps port 8080 and PostgreSQL port 5432 completely off the public internet while terminating TLS on port 443.

Architecture diagram showing self-hosted NocoDB behind Caddy or Nginx HTTPS proxy connected to PostgreSQL 16

Prerequisites and Required NocoDB Environment Variables

Prepare an Ubuntu 22.04 or 24.04 VPS (at least 2 GB RAM recommended for PostgreSQL + NocoDB) with Docker Engine and Docker Compose installed, and point an A record (such as nocodb.yourdomain.com) to your server’s public IPv4 address. If you are setting up a fresh server, check our Ubuntu VPS setup guide for initial SSH and UFW steps.

According to the official NocoDB installation documentation, three environment variables matter most for a stable PostgreSQL + HTTPS deployment:

Environment VariablePurposeProduction Example / Note
NC_DBPostgreSQL connection string for NocoDB metadatapg://postgres:5432?u=nocodb&p=STRONG_PASS&d=nocodb
NC_AUTH_JWT_SECRETSigns user session and API JWT tokensGenerate a long random 32+ character secret
NC_PUBLIC_URLCanonical HTTPS URL behind reverse proxyhttps://nocodb.yourdomain.com (fixes webhooks & links)

Step 1: Deploy NocoDB and PostgreSQL 16 with Docker Compose

Create a project directory such as /opt/nocodb and save the docker-compose.yml file below. Two details make this production-ready: first, binding NocoDB’s port to 127.0.0.1:8080:8080 instead of 8080:8080 prevents Docker from bypassing UFW on the public interface (Docker and UFW port safety guide).

Second, adding a pg_isready healthcheck on the PostgreSQL service with condition: service_healthy guarantees NocoDB does not crash on boot while PostgreSQL is still initializing its data directory. Also make sure NC_AUTH_JWT_SECRET is set explicitly in your environment or .env file rather than left blank; otherwise, container restarts invalidate active user sessions.

Start the stack with sudo docker compose up -d and check sudo docker compose logs -f nocodb until it reports listening on port 8080. You can verify the container health locally with curl -I http://127.0.0.1:8080/api/v1/health before wiring up your domain.

services:
  postgres:
    image: postgres:16-alpine
    restart: unless-stopped
    environment:
      POSTGRES_DB: nocodb
      POSTGRES_USER: nocodb
      POSTGRES_PASSWORD: CHANGE_ME_STRONG_DB_PASSWORD
    volumes:
      - pg_data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U nocodb -d nocodb"]
      interval: 10s
      timeout: 5s
      retries: 10

  nocodb:
    image: nocodb/nocodb:latest
    restart: unless-stopped
    depends_on:
      postgres:
        condition: service_healthy
    ports:
      - "127.0.0.1:8080:8080"
    environment:
      NC_DB: "pg://postgres:5432?u=nocodb&p=CHANGE_ME_STRONG_DB_PASSWORD&d=nocodb"
      NC_AUTH_JWT_SECRET: "REPLACE_WITH_LONG_RANDOM_SECRET"
      NC_PUBLIC_URL: "https://nocodb.yourdomain.com"
    volumes:
      - nocodb_data:/usr/app/data

volumes:
  pg_data:
  nocodb_data:
sudo docker compose up -d
sudo docker compose logs -f nocodb

Step 2: Add Automatic HTTPS with Caddy (or Nginx + Certbot)

With NocoDB listening on 127.0.0.1:8080, configure a reverse proxy to terminate HTTPS on port 443. Caddy is the fastest option because it obtains and renews Let’s Encrypt TLS certificates automatically with a five-line Caddyfile.

If you already run Nginx on your VPS, create a standard server block with proxy_pass http://127.0.0.1:8080 (including WebSocket Upgrade and X-Forwarded-Proto headers) and run sudo certbot --nginx -d nocodb.yourdomain.com.

Open https://nocodb.yourdomain.com in your browser to create your first Super Admin account. Because NC_PUBLIC_URL matches your domain, shared views, invite links, and API docs will all resolve cleanly over HTTPS.

# /etc/caddy/Caddyfile
nocodb.yourdomain.com {
    reverse_proxy 127.0.0.1:8080
}
# Optional UFW firewall check
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw status

Step 3: Back Ups, Firewall Rules, and Production Checklist

To keep your NocoDB instance resilient on Aveshost self-managed VPS hosting or fully managed VPS hosting, keep only ports 80 and 443 open publicly in UFW. If you only want internal team access—or want to lock down SSH—pair your VPS with Tailscale private VPS access.

Never expose PostgreSQL port 5432 in your Compose file or firewall; keeping PostgreSQL on the internal Docker bridge network ensures only the NocoDB container can query it. When applying container updates later, pull the new image and recreate only the application service with sudo docker compose pull && sudo docker compose up -d.

Finally, schedule automated daily pg_dump exports of your PostgreSQL database alongside backups of the nocodb_data volume (/usr/app/data) so both structured tables and uploaded attachments can be restored cleanly. Test restoring a dump to a staging container periodically to confirm your backup files are complete.

Six-step production checklist for self-hosting NocoDB with PostgreSQL and HTTPS on a VPS
# Daily PostgreSQL dump
sudo docker compose exec -T postgres pg_dump -U nocodb nocodb > /opt/nocodb/nocodb-backup.sql

Frequently asked questions

How much RAM does a self-hosted NocoDB + PostgreSQL VPS need?

While NocoDB can boot on 1 GB RAM for light testing, 2 GB to 4 GB RAM is recommended on an Ubuntu VPS when running PostgreSQL 16, NocoDB, and a reverse proxy together in production.

Why should I set NC_PUBLIC_URL when running NocoDB behind Caddy or Nginx?

Without NC_PUBLIC_URL set to your full https:// domain, NocoDB may generate localhost or HTTP links for shared views, password resets, OAuth callbacks, and webhook payloads behind a reverse proxy.

Why bind NocoDB to 127.0.0.1:8080:8080 instead of 8080:8080 in Docker Compose?

Binding to 127.0.0.1 ensures only your local Caddy or Nginx reverse proxy can reach NocoDB, preventing Docker’s iptables rules from exposing unencrypted port 8080 to the public internet.

Can I migrate NocoDB from SQLite to PostgreSQL later?

Starting directly on PostgreSQL 16 is much simpler for production. If you already run SQLite, NocoDB supports connecting external PostgreSQL data sources or exporting/migrating bases, though starting with NC_DB pointed at PostgreSQL avoids manual metadata migration.

Which reverse proxy is easier for NocoDB HTTPS: Caddy or Nginx?

Caddy is simpler for single-app VPS setups because it provisions and renews Let’s Encrypt TLS certificates automatically with minimal config. Nginx + Certbot is ideal if you already host multiple sites on the same VPS.

James Wilson

For over 10 years, James Wilson has been working in the tech industry. He's an expert in areas like software development, cybersecurity, and cloud computing. He understands the challenges and opportunities that new tech companies face, and he's known for coming up with creative solutions to help them succeed.