n8n Self-Hosted: Complete Guide to Setup, Security, and Scaling (Docker)

Looking to run n8n on your own infrastructure? This comprehensive n8n self-hosted guide shows you how to deploy n8n with Docker, secure it for production, back it up, and scale it when your automations grow. You’ll also find a quick-start docker-compose, best practices, and an FAQ.

Why choose n8n self-hosted?

  • Full control and data privacy: Keep credentials, webhooks, and workflow data on your own servers.
  • Flexibility: Customize runtime, integrations, networking, and scaling.
  • Cost efficiency at scale: Predictable hosting costs versus per-user or per-execution pricing.

Prerequisites

  • A Linux VM or server (2+ vCPU, 4+ GB RAM recommended)
  • Docker and Docker Compose installed
  • A domain (e.g., your-domain.com) pointed to the server
  • Basic familiarity with the terminal

Quick start: n8n self-hosted with Docker and Traefik

The following setup runs n8n behind Traefik (automatic HTTPS via Let’s Encrypt) and stores data in PostgreSQL for reliability and performance.