Skip to main content
Self-hosting Directus gives you complete control over your data, infrastructure, and deployment environment. This guide covers deploying Directus on your own servers.

Requirements

Before deploying Directus, ensure your environment meets these requirements:

System Requirements

  • Node.js: Version 22 or higher
  • Package Manager: pnpm 10.x (recommended) or npm
  • Operating System: Linux, macOS, or Windows Server
  • Memory: Minimum 512MB RAM (2GB+ recommended)

Database Support

Directus works with any of these SQL databases:
  • PostgreSQL 13+ (recommended)
  • MySQL 8.0+ or 5.7+
  • MariaDB 11.4+
  • SQLite 3.x (development only)
  • Microsoft SQL Server 2019+
  • OracleDB 18+
  • CockroachDB 24.3+

Optional Services

  • Redis: For caching and rate limiting
  • S3-compatible Storage: For file storage (AWS S3, MinIO, etc.)
  • SMTP Server: For email notifications

Installation Methods

Quick Start

1

Install Directus

Create a new directory and install Directus:
2

Configure Environment

Create a .env file with your database configuration:
3

Bootstrap Database

Initialize the database and create admin user:
4

Start Directus

Launch the Directus server:
Your Directus instance will be available at http://localhost:8055

Database Configuration

Configure your database connection using environment variables:

Production Deployment

Using PM2

PM2 is a production process manager for Node.js applications:
1

Install PM2

2

Create Ecosystem File

Create ecosystem.config.cjs in your project root:
3

Start with PM2

Using systemd

For Linux systems with systemd:
1

Create Service File

Create /etc/systemd/system/directus.service:
2

Enable and Start

Reverse Proxy Setup

Nginx

Configure Nginx as a reverse proxy:

Apache

Configure Apache with mod_proxy:

Caddy

Caddy configuration with automatic HTTPS:

SSL/TLS Configuration

Secure your Directus instance with HTTPS:

Using Let’s Encrypt with Certbot

Update Directus Configuration

Set the public URL to use HTTPS:

Storage Configuration

Configure file storage for uploads:

Email Configuration

Set up email for password resets and notifications:

Monitoring and Logging

Configure logging for production:

Backup Strategy

Implement regular backups:

Database Backups

File Storage Backups

Scaling Considerations

Horizontal Scaling

Run multiple Directus instances behind a load balancer:
  • Use Redis for session storage and caching
  • Use S3-compatible storage (not local filesystem)
  • Enable database connection pooling
  • Configure sticky sessions on load balancer

Performance Optimization

Security Best Practices

  1. Use Strong Secrets: Generate cryptographically secure random strings for SECRET
  2. Enable HTTPS: Always use SSL/TLS in production
  3. Configure CORS: Restrict origins to your application domains
  4. Rate Limiting: Enable rate limiting to prevent abuse
  5. Regular Updates: Keep Directus and dependencies updated
  6. Firewall: Restrict database access to application servers only
  7. Backups: Implement automated backup strategy

Troubleshooting

Check Logs

Health Check

Verify Directus is running:

Common Issues

  • Port already in use: Change PORT in .env file
  • Database connection failed: Verify database credentials and host
  • Permission denied: Ensure user has write access to uploads directory
  • Out of memory: Increase server memory or reduce max_memory_restart

Next Steps