n8n environment variables: the production reference

There are 200+ env vars in n8n. About 25 of them matter for a production install. This is the curated list: what to set, what to leave alone, and which defaults are dangerous.

Disclosure: contains an affiliate link to Inferno VPS.

How to read this page

Each variable below has three things: a recommended production value, why we set it that way, and the failure mode if you ignore it. Variables are grouped by area, in the order you'll touch them when setting up a fresh install.

If you're starting from scratch, copy our production Compose file and use this page as the reference for what each value means.

Host, URL, and proxy

N8N_HOST

Set to: your public hostname, e.g. n8n.example.com.
Why: n8n uses this to construct absolute URLs in the editor and to validate incoming webhooks.
If wrong: editor links break, OAuth callbacks fail, webhook signature validation rejects valid requests.

N8N_PROTOCOL

Set to: https in production.
Why: tells n8n to generate https:// URLs (for OAuth callbacks, webhook display, email notifications).
If wrong: OAuth integrations refuse the callback URL.

N8N_PORT

Set to: 5678 (the default; rarely change).
Why: port n8n binds to inside the container. Externally exposed port is controlled by Docker, not this value.

WEBHOOK_URL

Set to: https://n8n.example.com/ — same hostname, with trailing slash.
Why: the public base URL n8n shows you when you create a webhook node and the URL n8n sends to third parties at registration time.
If wrong: Stripe, Telegram, GitHub etc. will register a broken webhook URL and never reach n8n.

N8N_PROXY_HOPS

Set to: 1 when running behind a single reverse proxy (Nginx, Traefik, Caddy).
Why: n8n reads client IPs from X-Forwarded-For; this value tells it how many proxies to trust.
If wrong: rate limiting treats every request as coming from the proxy IP (so everyone shares one quota) or from a forged header (so attackers spoof bypass).

Database

DB_TYPE

Set to: postgresdb for any non-toy install.
Why: SQLite is fine on a laptop, painful in production — single-writer, no concurrent execution, hard to back up live.
If wrong: you'll outgrow SQLite around your hundredth workflow and the migration is a chore.

DB_POSTGRESDB_HOST / PORT / DATABASE / USER / PASSWORD

Set to: values matching your Postgres container or external Postgres.
Note: if Postgres is in the same Compose project, HOST is the service name (postgres), not 127.0.0.1.

DB_POSTGRESDB_SSL_ENABLED

Set to: true if you connect to a managed Postgres over the public internet; false for in-Compose Postgres (which never leaves the internal network).

Encryption and secrets

N8N_ENCRYPTION_KEY

Set to: a strong random value, e.g. openssl rand -base64 32.
Why: encrypts every credential (API tokens, OAuth secrets) at rest in the database.
If wrong / lost: every saved credential becomes unreadable garbage. Back up this value the way you back up your Postgres password — see the backup guide.

N8N_USER_MANAGEMENT_JWT_SECRET

Set to: another openssl rand -base64 32 value.
Why: signs session cookies. If you don't set it, n8n picks a random one on first start and stores it inside the data volume — losing the volume logs every user out.

Executions and pruning

EXECUTIONS_MODE

Set to: regular (default) for small installs; queue for any production beyond ~100 exec/hour. See queue mode.

EXECUTIONS_DATA_PRUNE

Set to: true — always.
Why: n8n stores the full input and output of every node in every execution. Without pruning the Postgres database doubles every few weeks on a busy instance.
If wrong: disk fills, Postgres slows, eventually n8n stops accepting new executions.

EXECUTIONS_DATA_MAX_AGE

Set to: 168 (one week of hours) for most cases. Raise to 720 (30 days) if you debug old runs often.

EXECUTIONS_DATA_PRUNE_MAX_COUNT

Set to: 10000 as an upper-bound safety net regardless of age.

EXECUTIONS_TIMEOUT / EXECUTIONS_TIMEOUT_MAX

Set to: -1 (no timeout) for most workflows, or a positive integer of seconds for hard kill-switches.
Note: per-workflow timeouts are also configurable in the editor — env vars set the global default.

Logging

N8N_LOG_LEVEL

Set to: info in production, debug only when you're actively diagnosing something.
If wrong: debug generates 5-10x the log volume and noticeably slows the event loop.

N8N_LOG_OUTPUT

Set to: console — let Docker handle log capture and rotation. Don't write to a file inside the container.

Security and trust

N8N_DIAGNOSTICS_ENABLED

Set to: false in production if you don't want n8n phoning home with usage stats. Default is true.

N8N_VERSION_NOTIFICATIONS_ENABLED

Set to: false to suppress upgrade banners and the daily version-check ping.

N8N_BLOCK_ENV_ACCESS_IN_NODE

Set to: true if multiple users build workflows on the instance.
Why: stops workflows from reading process.env and exfiltrating your Postgres password, encryption key, etc., via a Function or Code node.

N8N_DISABLE_UI

Set to: false on the main instance. Set to true on worker-only instances if you separate them, to prevent accidental UI exposure.

Queue mode (when EXECUTIONS_MODE=queue)

QUEUE_BULL_REDIS_HOST / PORT / PASSWORD / DB

Set to: values for your Redis instance. Inside Compose, HOST is the service name (redis).

QUEUE_HEALTH_CHECK_ACTIVE

Set to: true.
Why: enables self-healing of stuck executions when a worker dies mid-job.

N8N_WORKER_CONCURRENCY

Or use worker --concurrency=N on the command line. Default 10. Halve for AI-heavy workflows, double for short HTTP-only ones.

Timezone

GENERIC_TIMEZONE / TZ

Set to: the timezone you want cron-style triggers ("every Monday at 9 AM") to evaluate in. UTC is portable; a local zone matches business hours intuitively. Set both — n8n reads GENERIC_TIMEZONE; the Node runtime and Postgres read TZ.

Email (optional)

N8N_EMAIL_MODE / N8N_SMTP_*

Set to: SMTP credentials if you want password-reset emails to work. Otherwise leave blank — n8n falls back to a no-op and admins reset passwords via CLI.

Custom nodes

N8N_CUSTOM_EXTENSIONS

Set to: a path inside the container if you maintain custom community nodes you wrote yourself.

N8N_COMMUNITY_PACKAGES_ENABLED

Set to: true only if you trust the people who can install community packages from the UI. They execute arbitrary npm code in your n8n process.

A complete production .env example

# Host / proxy
N8N_HOST=n8n.example.com
N8N_PORT=5678
N8N_PROTOCOL=https
WEBHOOK_URL=https://n8n.example.com/
N8N_PROXY_HOPS=1

# Database
DB_TYPE=postgresdb
DB_POSTGRESDB_HOST=postgres
DB_POSTGRESDB_PORT=5432
DB_POSTGRESDB_DATABASE=n8n
DB_POSTGRESDB_USER=n8n
DB_POSTGRESDB_PASSWORD=                       # openssl rand -base64 32

# Encryption
N8N_ENCRYPTION_KEY=                           # openssl rand -base64 32
N8N_USER_MANAGEMENT_JWT_SECRET=               # openssl rand -base64 32

# Executions
EXECUTIONS_MODE=regular                       # or "queue"
EXECUTIONS_DATA_PRUNE=true
EXECUTIONS_DATA_MAX_AGE=168
EXECUTIONS_DATA_PRUNE_MAX_COUNT=10000

# Logging
N8N_LOG_LEVEL=info
N8N_LOG_OUTPUT=console

# Security
N8N_DIAGNOSTICS_ENABLED=false
N8N_VERSION_NOTIFICATIONS_ENABLED=false
N8N_BLOCK_ENV_ACCESS_IN_NODE=true

# Time
GENERIC_TIMEZONE=Europe/Helsinki
TZ=Europe/Helsinki

Looking for a VPS sized right for these settings?

The defaults above run comfortably on a 2 GB plan with pruned executions. For queue-mode setups, step up to 4 GB. Inferno's $3.49 and $7.99 plans cover both points.

View Inferno VPS plans →

What to do next


Author: Marek Vainionpää — SRE in Helsinki. Last reviewed: 2026-05-22 against n8n 1.71.3 documentation and a live production env.