Reference table of key n8n environment variables grouped by category.
This page lists the most commonly used environment variables for configuring a self-hosted n8n instance. Set these in your docker-compose.yml, .env file, or system environment.
| Variable | Description | Default |
|---|---|---|
N8N_HOST |
Hostname the n8n editor and API listen on | localhost |
N8N_PORT |
Port n8n listens on | 5678 |
N8N_PROTOCOL |
Protocol for generated URLs (http or https) |
http |
N8N_EDITOR_BASE_URL |
Public URL for the n8n editor (used for OAuth redirects and links) | Derived from host/port/protocol |
N8N_PERSONALIZATION_ENABLED |
Show the onboarding personalization survey | true |
N8N_TEMPLATES_ENABLED |
Enable the workflow templates library | true |
N8N_VERSION_NOTIFICATIONS_ENABLED |
Show notifications when a new n8n version is available | true |
GENERIC_TIMEZONE |
Default timezone for cron-based triggers | America/New_York |
N8N_PAYLOAD_SIZE_MAX |
Maximum request body size in MB | 16 |
| Variable | Description | Default |
|---|---|---|
DB_TYPE |
Database backend: sqlite or postgresdb |
sqlite |
DB_POSTGRESDB_HOST |
PostgreSQL server hostname | localhost |
DB_POSTGRESDB_PORT |
PostgreSQL server port | 5432 |
DB_POSTGRESDB_DATABASE |
PostgreSQL database name | n8n |
DB_POSTGRESDB_USER |
PostgreSQL username | root |
DB_POSTGRESDB_PASSWORD |
PostgreSQL password | (empty) |
DB_POSTGRESDB_SSL_ENABLED |
Enable SSL for PostgreSQL connections | false |
DB_POSTGRESDB_SSL_CA |
Path to custom CA certificate for PostgreSQL SSL | (empty) |
DB_POSTGRESDB_SSL_REJECT_UNAUTHORIZED |
Reject connections with untrusted SSL certificates | true |
DB_SQLITE_VACUUM_ON_STARTUP |
Run VACUUM on SQLite database at startup to reclaim space | false |
| Variable | Description | Default |
|---|---|---|
N8N_ENCRYPTION_KEY |
Key used to encrypt stored credentials. Must remain consistent across restarts. | Auto-generated on first run |
N8N_USER_MANAGEMENT_DISABLED |
Disable multi-user authentication (single-user mode) | false |
N8N_BASIC_AUTH_ACTIVE |
Enable basic HTTP auth for the editor (deprecated in favor of user management) | false |
N8N_BASIC_AUTH_USER |
Username for basic auth | (empty) |
N8N_BASIC_AUTH_PASSWORD |
Password for basic auth | (empty) |
N8N_BLOCK_ENV_ACCESS_IN_NODE |
Prevent the Code node from accessing environment variables | false |
Warning: Encryption key
If
N8N_ENCRYPTION_KEYis not explicitly set, n8n generates one automatically on first startup and stores it in the~/.n8ndirectory. If this file is lost (e.g., volume is deleted), all stored credentials become undecryptable. Always set this variable explicitly in production.
| Variable | Description | Default |
|---|---|---|
EXECUTIONS_MODE |
Execution mode: regular (in-process) or queue (Redis-backed worker mode) |
regular |
EXECUTIONS_TIMEOUT |
Maximum execution time in seconds. -1 for no limit. |
-1 |
EXECUTIONS_TIMEOUT_MAX |
Maximum value users can set for per-workflow timeout | 3600 |
EXECUTIONS_DATA_PRUNE |
Automatically delete old execution data | true |
EXECUTIONS_DATA_MAX_AGE |
Hours to retain execution data when pruning | 336 (14 days) |
EXECUTIONS_DATA_SAVE_ON_ERROR |
Save execution data for failed executions | all |
EXECUTIONS_DATA_SAVE_ON_SUCCESS |
Save execution data for successful executions | all |
EXECUTIONS_DATA_SAVE_ON_PROGRESS |
Save execution progress for each node | false |
EXECUTIONS_DATA_SAVE_MANUAL_EXECUTIONS |
Save data from manual (test) executions | true |
| Variable | Description | Default |
|---|---|---|
WEBHOOK_URL |
Public base URL for webhook endpoints. Must be set when behind a reverse proxy. | Derived from host/port/protocol |
N8N_ENDPOINT_WEBHOOK |
Path prefix for production webhooks | webhook |
N8N_ENDPOINT_WEBHOOK_TEST |
Path prefix for test webhooks | webhook-test |
N8N_ENDPOINT_REST |
Path prefix for the REST API | rest |
Tip
If webhooks are not reachable from external services,
WEBHOOK_URLis almost always the variable to check. It must match the publicly accessible URL of your n8n instance, including the protocol and any port or path prefix.
| Variable | Description | Default |
|---|---|---|
QUEUE_BULL_REDIS_HOST |
Redis host for queue mode | localhost |
QUEUE_BULL_REDIS_PORT |
Redis port | 6379 |
QUEUE_BULL_REDIS_PASSWORD |
Redis password | (empty) |
QUEUE_BULL_REDIS_DB |
Redis database number | 0 |
QUEUE_HEALTH_CHECK_ACTIVE |
Enable health check endpoint for workers | false |
I build production n8n and Cloudflare automation for teams — the same engineering behind HarperFlow. Fixed-price, escrow-protected, US-based.