Running N8N on Your Own Server: Deployment Guide

Step-by-step guide to deploying N8N with Docker, PostgreSQL, Traefik SSL, automated backups, and production hardening. Copy-paste configs included.

Server Requirements

Step 1: Initial Server Setup

Step 2: Create the Project Directory

Step 3: Create the Environment File

Step 4: Create the Docker Compose File

Step 5: Configure DNS

Step 6: Launch and Verify

Step 7: Firewall Configuration

Step 8: Automated Backups

Step 9: Updating N8N

Step 10: Scaling to Queue Mode

Troubleshooting Common Issues

Production Checklist

Cost Comparison: Self-Hosted vs. N8N Cloud

What to Build First

Self-hosting N8N gives you unlimited workflow executions with zero per-operation costs. N8N Cloud charges based on executions. A self-hosted instance on a $12/month VPS runs as many workflows as your hardware can handle. For most SMBs running 20-100 automations, that is a significant cost difference over 12 months.

This guide walks you through every step from bare server to production-ready N8N instance. Every command is copy-paste ready. Every config file is complete. By the end, you will have N8N running with PostgreSQL, automatic SSL certificates, automated nightly backups, and basic monitoring.

N8N is not resource-hungry for most SMB workloads, but undersizing your server causes workflow execution delays and timeouts that are painful to debug.

Recommended providers: Hetzner (best price-to-performance in Europe), DigitalOcean (solid US/global presence), Vultr (good hourly billing for testing). All three offer the Ubuntu 22.04 LTS image you need.

Operating system: Ubuntu 22.04 LTS. It has Long Term Support until 2027, the widest Docker compatibility, and the most community guides if you need help troubleshooting.

SSH into your fresh server and run the following. This updates the system, installs Docker and Docker Compose, and verifies everything is working.

You should see Docker 24+ and Docker Compose v2+. If either command fails, the installation did not complete correctly. Check the Docker install script output for errors.

The environment file stores your secrets and configuration. Generate strong random values for each secret. Never reuse passwords from other systems.

This configuration runs three containers: Traefik (reverse proxy with automatic SSL), PostgreSQL (database), and N8N itself. Traefik handles HTTPS termination and certificate renewal automatically via Let's Encrypt.

Before starting the containers, your domain must point to your server. Go to your DNS provider and create an A record:

Set TTL to 300 (5 minutes) for faster propagation during setup. You can increase it to 3600 after everything is working. Verify the DNS record has propagated before proceeding:

If the command returns your server IP, you are ready to proceed. If it returns nothing, wait a few minutes and try again. DNS propagation with a 300-second TTL typically completes within 5-10 minutes.

Open https://automation.yourdomain.com in your browser. You should see the N8N setup screen prompting you to create your first admin account. Create the account immediately. Until you do, anyone who finds the URL can claim the admin account.

Lock down your server so only the necessary ports are accessible. N8N's port 5678 should never be directly exposed to the internet. It should only be accessible through Traefik's reverse proxy on ports 80 and 443.

Backups are not optional. Your N8N instance contains your workflow definitions, execution history, and encrypted credentials. Losing this data means rebuilding every automation from scratch.

Create the backup script:

N8N releases updates frequently with new nodes, bug fixes, and security patches. Here is the safe update process:

When your workflow count or concurrency outgrows a single N8N instance, switch to queue mode. This separates the web UI (main process) from workflow execution (worker processes), letting you scale workers independently.

Signs you need queue mode:

Queue mode requires Redis. Add these environment variables to enable it:

You can run multiple worker containers to parallelize execution. Start with one worker and add more as needed.

Before you consider your deployment production-ready, verify every item on this list:

For most SMBs running more than 2,500 executions per month, self-hosting pays for itself in the first month. If your team runs fewer workflows and does not want to manage infrastructure, N8N Cloud is a reasonable starting point. You can always migrate to self-hosted later by exporting your workflows.

Once your N8N instance is running, start with these high-value workflows that most SMBs can implement in under an hour each:

Each of these replaces a manual process that someone on your team is doing multiple times per day. That is where automation delivers immediate, measurable ROI. For more workflow ideas, see our complete N8N automation guide and Make.com automation examples.

Once you are running, make sure to secure your deployment with the steps in our MCS Server Security guide. Need help deploying N8N or designing your first production workflows? Book a setup consultation and we will get your instance running in a single session.