This site contains affiliate links — we may earn a commission if you sign up through them.

Self-Hosting n8n on DigitalOcean 2026 — Complete Automation Guide

A practical guide to self-hosting n8n workflow automation on a DigitalOcean Droplet using Docker Compose, covering server sizing, domain and SSL setup, and workflow backups.

Self-Hosting n8n on DigitalOcean 2026 — Complete Automation Guide

n8n is an open-source workflow automation tool gaining popularity among Thai developers seeking alternatives to Zapier or Make without paying per-task monthly fees. This guide walks you through deploying n8n on a DigitalOcean Droplet using Docker Compose, from choosing server specifications, configuring your domain with SSL, to securely backing up workflows — with real commands ready to use immediately.

What is n8n? Can it Replace Zapier?

n8n is a node-based workflow automation tool released under a fair-code license. It connects applications together with minimal coding. Compared to Zapier or Make, n8n's standout feature is self-hosting support on your own server, eliminating limits on workflow count or monthly execution limits the way SaaS platforms charge per task. n8n Cloud also offers a managed SaaS version for those who prefer not to manage infrastructure. Feature-wise, n8n integrates with over 400 services including Google Workspace, Slack, Line Notify, Telegram, databases, and generic REST APIs. It also includes nodes for writing JavaScript/Python when ready-made integrations fall short. The key difference from Zapier is n8n gives finer control over data flow — loops, complex conditionals, custom error handling — making it ideal for teams with intricate workflows or high execution volumes. Can n8n replace Zapier? In many cases, yes — especially for high-execution workloads that would cost dearly in monthly Zapier tasks. Self-hosted n8n has fixed server costs regardless of run frequency, whereas Zapier charges per task. The trade-off is your team must handle server maintenance, updates, and security patches yourself, unlike SaaS vendors who manage everything. For developers comfortable with Docker and Linux, self-hosting on a DigitalOcean Droplet delivers compelling long-term value.

Deploying n8n with Docker Compose

Before installing n8n, choose a Droplet size matching your workload. For testing or personal use, a Basic Shared CPU plan of 1 GiB RAM/1 vCPU/25 GB SSD at $6/month works. However, for production use running n8n alongside PostgreSQL or multiple concurrent workflows, a 2 GiB RAM/1 vCPU/50 GB SSD plan at $12/month is recommended to prevent memory exhaustion and container crashes. After creating your Droplet and SSH-ing in, install Docker with the official script: curl -fsSL https://get.docker.com | sh Then verify the Docker Compose plugin is included: docker compose version Next, create a docker-compose.yml file to configure the n8n service: version: "3.8" services: n8n: image: n8nio/n8n:latest restart: unless-stopped ports: - "5678:5678" environment: - N8N_HOST=n8n.yourdomain.com - N8N_PROTOCOL=https - N8N_PORT=5678 - WEBHOOK_URL=https://n8n.yourdomain.com/ - GENERIC_TIMEZONE=Asia/Bangkok - N8N_ENCRYPTION_KEY=changeme-to-random-string volumes: - n8n_data:/home/node/.n8n volumes: n8n_data: Then start the container in the background: docker compose up -d Check status with docker compose ps and view logs with docker compose logs -f n8n Once the container runs normally, n8n listens on port 5678. Next comes domain and SSL configuration to secure webhooks and web access. Enable DigitalOcean's Cloud Firewall (no extra cost) to restrict open ports to 22, 80, and 443 only.

Configuring Domain and SSL

With n8n running on your Droplet, create a DNS A record pointing a subdomain like n8n.yourdomain.com to your Droplet's IP. Then install Nginx as a reverse proxy to accept traffic on ports 80/443 and forward it to n8n on port 5678 locally. Here's an example Nginx site config: server { listen 80; server_name n8n.yourdomain.com; location / { proxy_pass http://localhost:5678; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } } After verifying Nginx works, request a free SSL certificate from Let's Encrypt using Certbot: certbot --nginx -d n8n.yourdomain.com Certbot automatically updates your config to HTTPS and sets up HTTP-to-HTTPS redirect. Certificates expire every 90 days, so set up automatic renewal — Certbot installs a systemd timer by default in current versions. Verify with certbot renew --dry-run A common pitfall: your docker-compose.yml environment variables must match your actual domain. Specifically, N8N_HOST, N8N_PROTOCOL=https, and WEBHOOK_URL must align with your domain and SSL setup, or webhook nodes will generate incorrect URLs and external triggers fail. After editing docker-compose.yml, run docker compose up -d again for changes to take effect. Additionally, DigitalOcean's Cloud Firewall and VPC private networking are free and strengthen network security at no extra cost.

Basic Automation Workflow Example

Once your system is ready, a great starting example is a workflow capturing form submissions and sending automated alerts. The basic structure has three node types: trigger, logic, and action. Start by adding a Webhook node, which generates a unique URL for external systems like web forms to send data to n8n immediately on submit. Next, add an IF node to define conditions — for example, validate that incoming data includes required fields like email. If conditions pass, chain it to an HTTP Request node to call external APIs, like sending alerts via Line Notify or Telegram Bot API, or use a ready-made Google Sheets node to auto-log data. You can insert Set nodes to transform data in between — for example, concatenate first and last names, or format dates for the destination system. Another common pattern is a Schedule Trigger for time-based tasks — fetching API data every morning then summarizing it to Slack or email. Use the Schedule Trigger node to define cron expressions, such as running daily at 08:00 Bangkok time. Make sure to set GENERIC_TIMEZONE=Asia/Bangkok in docker-compose.yml to match, or schedules will run at the wrong time. Once your workflow is built, click Activate to start it running in the background without keeping n8n's UI open.

Key takeaway: Webhook nodes generate unique URLs for external systems to POST data to n8n in real-time

Backing Up Workflow Data

n8n stores workflows, credentials, and execution history in the /home/node/.n8n folder inside the container. According to the sample docker-compose.yml above, this path is mounted as a volume named n8n_data. If using SQLite (the default), all database files live in this single volume, offering multiple backup strategies depending on importance. First, the simplest approach: let DigitalOcean snapshot your entire Droplet at $0.06 per GiB per month. This suits full-system recovery if your server fails, but not selective workflow recovery. Second, use DigitalOcean Volumes at $0.10 per GiB per month to store backups separately from your Droplet's main disk, then set up a cron job running rsync or tar to regularly copy the .n8n folder into that volume. Third, recommended for production: export workflows and credentials directly using n8n's CLI. Run docker compose exec n8n n8n export:workflow --all --output=/home/node/.n8n/backup.json and n8n export:credentials --all --output=/home/node/.n8n/credentials.json These JSON files can be re-imported via n8n import:workflow --input=backup.json, allowing easy migration to new servers. Store these backup files outside your server — DigitalOcean Spaces (S3-compatible object storage starting at $5/month) ensures workflow recovery even if your main Droplet fails.

When to Use This Feature (Real-World Use Cases)

Self-hosting n8n on DigitalOcean suits many practical scenarios. First, teams with high workflow execution volumes where SaaS platforms like Zapier become expensive due per-task billing. Self-hosted n8n has fixed monthly Droplet costs regardless of execution count. Second, organizations requiring data residency compliance — keeping customer data on controlled infrastructure. Third, development teams needing custom integrations for internal systems lacking public APIs or ready-made connectors. n8n lets you write custom nodes or use Function nodes with JavaScript to connect freely. Teams already running systems on DigitalOcean benefit from connecting via free VPC private networks, which is faster and safer than public internet, with zero extra cost. However, self-hosting is not for everyone. If your team lacks Linux/Docker expertise, prefers minimal uptime risk, or wants Anthropic to handle security patches, n8n Cloud's managed SaaS or DigitalOcean App Platform may suit better. App Platform's Shared tier (1 vCPU/1 GiB RAM/100 GB transfer at $10/month) cuts infrastructure management burden compared to direct Droplet deployment, even if less flexible than Docker Compose on a Droplet.

Common Errors and Troubleshooting

A point users often miss: the most common issue: webhooks from external systems fail to trigger. Usually the WEBHOOK_URL and N8N_HOST in docker-compose.yml don't match your actual domain. Fix by verifying both values align with your real domain, then run docker compose up -d again to apply changes. Second problem: containers hang or restart frequently, typically from undersized Droplets. A 1 GiB RAM plan isn't enough when multiple workflows run concurrently or process large data. Fix by upgrading to 2 GiB RAM or higher, or switch from SQLite to PostgreSQL to reduce disk I/O. Third issue: workflow data disappears after a restart. This happens when the volume mount to /home/node/.n8n is missing, leaving data only in temporary container storage. Verify your docker-compose.yml includes the volume mount. Fourth: schedule triggers run at the wrong time — usually because GENERIC_TIMEZONE isn't set, so n8n defaults to UTC instead of Bangkok time. Fifth and most serious: forgetting to set N8N_ENCRYPTION_KEY from the start means n8n auto-generates one. If your container is recreated without the old volume or you migrate servers without backing up this key, encrypted credentials become unrecoverable and you must reconfigure everything. Prevention: define an encryption key as a fixed random value from day one, and store a copy somewhere safe outside your server.

Best Practices

To keep self-hosted n8n stable and secure long-term, follow these best practices from day one. Define N8N_ENCRYPTION_KEY as a fixed random value and store a copy securely outside your server to prevent credentials becoming unrecoverable if you need to recover or migrate. For production with many workflows or frequent executions, migrate from SQLite to PostgreSQL to handle concurrent reads and writes better and reduce database corruption risk. Run PostgreSQL as another service in the same docker-compose.yml or use DigitalOcean Managed Database to offload database administration. On security: enable n8n's built-in user management to assign per-person access controls instead of sharing one passwordless instance. Regularly update your n8n image with docker compose pull && docker compose up -d to receive the latest security patches. For networking, use DigitalOcean's free Cloud Firewall to restrict open ports to 22, 80, and 443. When other services need to connect (databases, other Droplets), use free VPC private networking instead of exposing ports to the public internet. Finally, set up monitoring: enable DigitalOcean's free Monitoring to watch Droplet CPU and memory, and configure one free Uptime Check per account to verify n8n stays responsive. If you plan to migrate or failover Droplets later, use Reserved IPs (free as long as attached to an active Droplet) so DNS and webhook URLs never need changing even if you move the instance.

  1. Set N8N_ENCRYPTION_KEY as a fixed value from the start and store a backup outside your server
  2. Migrate from SQLite to PostgreSQL for production deployments with many workflows
  3. Enable n8n user management and update images regularly via docker compose pull for security patches

Get $200 Free Credit →

Frequently Asked Questions

Is n8n self-hosting truly free? What costs are involved?
n8n itself is open-source under a fair-code license — self-hosting is completely free with unlimited workflows. Real costs are your Droplet monthly fees, starting at $6/month for basic testing or $12/month for production recommended specs. Optional expenses include backups or additional storage if needed.
What are the minimum Droplet specs required?
For testing, a Basic plan with 1 GiB RAM/1 vCPU/25 GB SSD at $6/month works. For production with concurrent workflows or PostgreSQL, upgrade to 2 GiB RAM/1 vCPU/50 GB SSD at $12/month or higher for stability.
How does n8n differ from Zapier or Make?
The main differences are pricing and control. n8n self-host has fixed monthly costs regardless of execution count, while Zapier/Make bill per-task. Self-hosted n8n also gives you full data and environment control, but you handle server maintenance yourself.
How often should workflow data be backed up, and where should it be stored?
Set up daily cron exports of workflows and credentials as JSON files using n8n CLI commands, combined with periodic Droplet Snapshots. Upload backup files outside your server — DigitalOcean Spaces is ideal for off-server protection against complete server failure.
Can I use DigitalOcean Marketplace's 1-Click App to install n8n?
DigitalOcean Marketplace offers 1-Click Apps for various tools, but deploying n8n with Docker Compose as shown in this guide gives better control over environment variables like encryption keys and webhook URLs, making it the recommended approach for production use.
If I don't want to manage the server myself, what are my options?
Two main alternatives: use n8n Cloud, a managed SaaS where n8n handles all infrastructure, or deploy via DigitalOcean App Platform like the Shared tier (1 vCPU/1 GiB RAM/100 GB transfer at $10/month), which reduces OS-level management compared to running directly on a Droplet.