This guide installs n8n using the official Docker Compose workflow.
For Docker installation, see Docker.
mkdir n8n-compose
cd n8n-compose
local-files Directoryn8n uses a dedicated directory for file operations and workflow data.
mkdir local-files
.env FileCreate an .env file with your domain, protocol, timezone, and credentials. Example:
# Domain and protocol
N8N_HOST=n8n.example.com
N8N_PROTOCOL=https
N8N_PORT=5678
# Security (generate a random 32+ character key)
N8N_ENCRYPTION_KEY=your-secure-random-encryption-key-here
N8N_SECURE_COOKIE=true
# Timezone
TZ=Europe/Berlin
GENERIC_TIMEZONE=Europe/Berlin
# PostgreSQL (optional, for production)
DB_TYPE=postgresdb
DB_POSTGRESDB_HOST=127.0.0.1
DB_POSTGRESDB_PORT=5432
DB_POSTGRESDB_DATABASE=n8n
DB_POSTGRESDB_USER=n8n
DB_POSTGRESDB_PASSWORD=your-strong-password-here
The official docs list all required variables and examples at n8n Environment Variables.
Use the official Docker Compose configuration from the n8n hosting docs (or the n8n-hosting repository) and save it as compose.yaml.
docker compose up -d
Open http://YOUR-SERVER:5678 to complete the initial setup.
See n8n Configuration for configuration guidance.
See n8n Security for hardening guidance.
Prefer automation? See n8n Ansible Setup for an example playbook.
Prefer a Docker-focused walkthrough? See n8n Docker Setup.
Stuck on a step or need custom configuration? We provide paid consulting for N8N deployments, from basic setups to enterprise configurations.