Intermediate · 30 minutes
Self-host n8n with Docker and HTTPS
Deploy n8n with Docker Compose, secure with HTTPS, and configure basic production hardening.
Prerequisites
- Ubuntu server with Docker and Docker Compose
- A domain/subdomain pointed to your server
- Basic familiarity with reverse proxies
Implementation steps
Step 1
Prepare compose stack
Create `docker-compose.yml` with n8n, persistent volume, timezone, and execution process settings. Store credentials in `.env` and never commit secrets.
Step 2
Add HTTPS
Place n8n behind Caddy or Nginx with automatic TLS. Set `N8N_HOST`, `N8N_PROTOCOL=https`, and webhook URL so external triggers resolve correctly.
Step 3
Harden instance
Enable basic auth, limit public ports, configure backup for volumes, and set restart policies. Keep image tags pinned for predictable upgrades.
Expected outcome
A secure self-hosted n8n instance with persistent storage, HTTPS, and production-grade baseline controls.