Paperless-ngx on Ubuntu 24.04 (Docker Compose + PostgreSQL + Redis + Nginx + SSL)

Paperless-ngx is a modern, open-source document management system (DMS) that helps you scan, organize, tag, and search digital documents with ease. It automatically processes your files using OCR (Optical Character Recognition), making every word in your PDFs or images fully searchable. Paperless-ngx provides a clean, fast web interface, integrates with email, scanners, and cloud storage, and supports multi-user environments — ideal for individuals, businesses, and organizations transitioning to a paperless workflow.

Running Paperless-ngx on Ubuntu 24.04 LTS (Noble Numbat) offers long-term stability, strong security, and up-to-date packages. Combined with Docker Compose, PostgreSQL, Redis, and Nginx with SSL, this setup provides a reliable, production-ready architecture suitable for both home and enterprise document management needs.


Architecture Overview

LayerComponentRole
OSUbuntu 24.04 LTSLong-term supported, secure base system
Container RuntimeDocker Engine + ComposeOrchestrates Paperless-ngx and its supporting services
ApplicationPaperless-ngx (Django)Core application for document management and OCR
DatabasePostgreSQL 15/16Stores document metadata, tags, and user information
Cache/QueueRedisHandles background tasks, caching, and asynchronous job queues
Reverse ProxyNginxManages HTTPS termination, routing, and compression
TLSLet’s Encrypt / PKIProvides SSL certificates for secure web access

Why Use Paperless-ngx?

  • Automated OCR – makes all scanned documents searchable by content.
  • Smart tagging & filtering – auto-categorizes documents with custom rules.
  • Multi-user environment – separate access and permissions per user.
  • Multiple import options – watch directories, email imports, and web upload.
  • Fast search engine – instant results using indexed OCR data.
  • Clean and responsive UI – mobile-friendly web interface.
  • Self-hosted and private – complete ownership of your documents and data.

Paperless-ngx vs Other Document Management Systems

Feature/CapabilityPaperless-ngx (Self-hosted)Mayan EDMSNextcloudZoho WorkDrive
HostingSelf-hosted / DockerSelf-hostedCloud / Self-hostedCloud only
OCR Support✅ Yes✅ Yes❌ No❌ No
Auto Tagging✅ Yes✅ Limited❌ No✅ Partial
User Management✅ Yes✅ Yes✅ Yes✅ Yes
Privacy100% local control100% localPartialCloud only
CostFree, open-sourceFreeFree/PaidPaid

Paperless-ngx is the leading open-source alternative for secure, private document management — combining enterprise features with self-hosting freedom.


Security & Best Practices

  • Run behind Nginx with HTTPS (Let’s Encrypt or custom SSL).
  • Store credentials and environment variables securely in .env or Docker secrets.
  • Restrict PostgreSQL and Redis to the internal Docker network.
  • Use UFW or nftables to allow only ports 80 and 443.
  • Automate SSL renewal using Certbot or Traefik ACME integration.
  • Keep Ubuntu, Docker, and Paperless-ngx images updated regularly.
  • Schedule automated PostgreSQL and media backups.
  • Enforce file permissions and SELinux/AppArmor for uploaded content.
  • Use strong admin credentials and unique secret keys.

Typical Use Cases

  • Personal archives – digitize and organize bills, receipts, and records.
  • Small businesses – manage invoices, contracts, and correspondence.
  • Law offices & accounting firms – create searchable document repositories.
  • Educational institutions – store and manage reports, student files, and papers.
  • Government or NGOs – securely archive administrative documents.
  • Remote teams – collaborate and access documents securely from anywhere.

Deploying Paperless-ngx on Ubuntu 24.04 with Docker Compose, PostgreSQL, Redis, and Nginx provides a high-performance, private, and searchable document management system that replaces traditional filing cabinets with a scalable, open-source digital archive — built for efficiency and control.


Create Your Server Instance on Shape.Host

Before installing Paperless-ngx, you need a fresh Ubuntu 24.04 VPS.
To deploy one quickly and reliably, follow these steps:

Go to https://shape.host and log in to your account.

Click the “Create” button (top-right).

Select “Instance.”

Shape.host Resources dashboard with Create > Instance highlighted.

Choose your preferred data center location.

Shape.host instance form with the data center location selector highlighted.

In the OS list, select Ubuntu 24.04 (64-bit).

Choose a server plan — recommended minimum:

2 vCPUs

4 GB RAM

20 GB SSD/NVMe

Shape.host instance form with the operating system image selector highlighted.

Click Create Instance to deploy the server.

After 20–40 seconds, your VPS will be ready.

Shape.host instance form with the Create Instance button highlighted.

Copy the instance’s public IP address.

Now you can connect to the server over SSH.

Shape.host Resources dashboard with the server IP address highlighted.

Connect to Your Server

Linux/macOS

ssh root@your_server_ip

This logs you into the remote server.

Windows

Use PuTTY and connect as root.


Step 1: Update Your System

apt update

Updates Ubuntu’s package index.

Terminal showing APT package management commands and output.

Step 2: Install Required Tools

apt install curl git gnupg ca-certificates lsb-release

These packages allow the system to download files, verify keys, and detect the Ubuntu version.

Terminal showing APT package management commands and output.

Step 3: Add the Official Docker Repository

Download Docker’s GPG key

curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc

Fix permissions

chmod a+r /etc/apt/keyrings/docker.asc

Create keyring directory

install -m 0755 -d /etc/apt/keyrings

Download the key again (command from your history)

curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc

Fix permissions again

chmod a+r /etc/apt/keyrings/docker.asc

Add Docker repository

echo   "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] \
  https://download.docker.com/linux/ubuntu \
  $(. /etc/os-release && echo $VERSION_CODENAME) stable"   > /etc/apt/sources.list.d/docker.list

Docker can now be installed from the official source.

Terminal showing APT package management commands and output.

Step 4: Install Docker + Docker Compose

apt update
apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

Installs:

  • Docker Engine
  • containerd
  • Buildx
  • Docker Compose v2
Terminal showing APT package management commands and output.

Step 5: Enable and Start Docker

systemctl enable docker
systemctl start docker

Step 6: Verify Docker Compose

docker compose version

Step 7: Create Paperless-ngx Directory

mkdir -p /opt/paperless
cd /opt/paperless
Terminal showing systemd service management commands or output.

Step 8: Generate a Secret Key

openssl rand -base64 32

Copy the output — this will be your PAPERLESS_SECRET_KEY.


Step 9: Create the Docker Compose File

nano /opt/paperless/docker-compose.yml

Paste:

services:

  redis:
    image: redis:7
    container_name: paperless_redis
    restart: unless-stopped

  db:
    image: postgres:15
    container_name: paperless_db
    restart: unless-stopped
    environment:
      POSTGRES_DB: paperless
      POSTGRES_USER: paperless
      POSTGRES_PASSWORD: strongpassword
    volumes:
      - db-data:/var/lib/postgresql/data

  webserver:
    image: ghcr.io/paperless-ngx/paperless-ngx:latest
    container_name: paperless_web
    depends_on:
      - db
      - redis
    ports:
      - "8000:8000"
    restart: unless-stopped
    environment:
      PAPERLESS_REDIS: redis://redis:6379
      PAPERLESS_DBHOST: db
      PAPERLESS_DBNAME: paperless
      PAPERLESS_DBUSER: paperless
      PAPERLESS_DBPASS: strongpassword
      PAPERLESS_SECRET_KEY: "PASTE_YOUR_SECRET_KEY_HERE"
      PAPERLESS_URL: "https://your-domain.com"
      PAPERLESS_TIME_ZONE: "Europe/Bucharest"
    volumes:
      - data:/usr/src/paperless/data
      - media:/usr/src/paperless/media
      - consume:/usr/src/paperless/consume

volumes:
  db-data:
  data:
  media:
  consume:

Save with:
CTRL+O → ENTER → CTRL+X

Terminal showing application configuration fields.

Step 10: Start Paperless-ngx

docker compose up -d

This launches Redis, PostgreSQL, and Paperless-ngx.

Terminal showing container image download progress.

Step 11: Check Running Containers

docker ps

If all three are listed, the system is working correctly.

Terminal showing the Docker container listing.

Step 12: Access Paperless-ngx

Open:

http://YOUR_SERVER_IP:8000

Paperless-ngx is now running successfully.

You now have a fully functional Paperless-ngx document management system running on Ubuntu 24.04 inside Docker.

Paperless-ngx initial account sign-up form.
Paperless-ngx dashboard with a welcome panel and document controls.

For stable long-term hosting, high performance, and simple scaling, consider running Paperless-ngx on a Shape.Host Cloud VPS.

Shape.Host provides:

  • Fast NVMe storage
  • High availability cloud infrastructure
  • Easy instance creation
  • Reliable performance for Docker workloads
  • Flexible pricing for both small and large deployments

Whether you’re self-hosting document management, automation services, or business applications, Shape.Host offers the perfect environment for production-grade Docker deployments.