How to Install Directus as a Self-Hosted Headless CMS

Directus provides a headless CMS/data platform that wraps around your own SQL database, giving you a genuine content management API without dictating your database schema. This guide covers self-hosted setup.

What Makes Directus Distinct

Unlike most CMS platforms that impose their own database schema, Directus wraps around your existing (or newly created) SQL database, auto-generating a REST/GraphQL API and admin interface from your actual schema — genuinely useful if you want CMS convenience without giving up direct database control.

Step 1 — Set Up a Database

See How to Install PostgreSQL and Configure It for Production Use — Directus supports PostgreSQL, MySQL, and several other databases; PostgreSQL is a commonly recommended choice.

Step 2 — Run Directus via Docker (Recommended)

docker run -d --name directus \
  -p 8055:8055 \
  -e KEY=$(openssl rand -hex 16) \
  -e SECRET=$(openssl rand -hex 16) \
  -e DB_CLIENT=pg \
  -e DB_HOST=your-db-host \
  -e DB_PORT=5432 \
  -e DB_DATABASE=directus \
  -e DB_USER=directus_user \
  -e DB_PASSWORD=CHANGE_ME \
  -e [email protected] \
  -e ADMIN_PASSWORD=CHANGE_ME \
  directus/directus

Docker is the officially recommended deployment method, simplifying dependency management considerably.

Step 3 — Access the Admin Panel

http://YOUR_SERVER_IP:8055

Step 4 — Set Up Nginx Reverse Proxy with HTTPS

See How to Set Up Nginx as a Reverse Proxy for Node.js Apps for the general pattern — never expose Directus's admin panel without HTTPS given the sensitivity of database management access.

Connecting to an Existing Database Schema

If pointed at a database with existing tables, Directus automatically discovers and exposes them through its interface — a genuinely useful capability if you have existing application data you want to add CMS-style management to, without migration.

Configuring API Access Permissions

Directus provides granular role-based access control for both the admin interface and API access — configure appropriately restrictive permissions for public API access, similar consideration to How to Install Strapi Headless CMS on a VPS's permission configuration.

Using the Generated API

GET https://cms.yourdomain.com/items/articles

Directus auto-generates REST and GraphQL endpoints based on your database schema — consume these from your actual frontend application, similar architectural pattern to other headless CMS setups.

Setting Up File/Asset Storage

STORAGE_LOCATIONS=local
STORAGE_LOCAL_ROOT=/directus/uploads

Configure local file storage, or integrate with S3-compatible object storage (see How to Set Up Self-Hosted S3-Compatible Object Storage with MinIO) for media/asset management scalability.

Backing Up Directus

Back up both the underlying database (containing your actual content/schema) and any file storage — Directus itself is largely stateless configuration wrapped around your database, making the database backup the most critical component.

Common Errors

Existing database tables not appearing in Directus interface — verify Directus has appropriate database permissions to introspect the schema, and check whether tables need explicit "collection" configuration within Directus before appearing in the managed interface.

Continue Reading

Browse more articles in CMS Platforms Beyond WordPress.

  • directus headless cms setup, directus docker installation, database backed cms, directus self hosted
  • 0 gebruikers vonden dit artikel nuttig
Was dit antwoord nuttig?

Gerelateerde artikelen

How to Install Drupal on a VPS

Drupal is a powerful, highly flexible open-source CMS well-suited for complex content structures,...

How to Install Joomla on a VPS

Joomla is a mature, feature-rich open-source CMS offering a middle ground between WordPress's...

How to Install Craft CMS on a VPS

Craft CMS is a developer-friendly, content-first CMS known for its flexible content modeling and...

How to Install TYPO3 on a VPS

TYPO3 is an enterprise-grade CMS widely used in Europe for large, complex websites needing...

How to Install Grav (Flat-File CMS) on a VPS

Grav is a modern, flat-file CMS — it stores content as files rather than in a database,...