Automation tools often charge by workflow count or monthly seat. Freelancers and small businesses can quickly outgrow free plans. The n8n Cloud free tier only allows 5 active workflows. Paid plans start around $20 per month per user. Still, there is another path. You can self-host n8n on a $5 virtual private server. You get full access to the same automation engine. Your monthly cost stays flat no matter how many workflows you run. This guide walks through the entire setup from scratch. You do not need to be a Linux expert to complete it.

This project differs from using Zapier or Make. Those platforms handle hosting for you but charge recurring fees. With n8n you manage the server. That means you also own your data and logs. Many freelancers prefer this for client work because they can keep sensitive information off third party clouds. The tradeoff is setup time. You need about 60 to 90 minutes and basic command line comfort. If you want to compare n8n to other tools, read our n8n review. That article covers pricing and where self-hosting makes sense.

We will use Docker and Docker Compose for the install. Docker isolates n8n from the rest of your server. You can update n8n by changing a version tag. You can also move the entire installation to another VPS with two files. The official n8n documentation recommends Docker for most self-hosted deployments. We also reference Make.com for a hosted automation comparison. Still, the focus here is a private n8n server that costs about $5 per month in infrastructure.

This guide covers eight steps. You will choose a VPS, set up DNS, install Docker, configure n8n, add SSL, secure authentication, create backups, and connect your first integration. By the end you will have an automation server that can run hundreds of tasks per day. You can then follow our beginner workflow guide to build your first scenario. Let’s start with the server.

What You’ll Need

  • A $5 per month VPS with 1GB RAM
  • A domain or subdomain
  • SSH client
  • Docker and Docker Compose
  • Caddy reverse proxy
  • n8n Docker image

How Do You Self-Host n8n on a $5 VPS Without Monthly Fees?

  1. Choose a $5 VPS with at least 1GB of RAM

A typical $5 VPS includes 1 virtual CPU, 1GB of RAM, 25GB of SSD storage, and 1TB of monthly transfer. Providers like DigitalOcean, Vultr, Linode, and Hetzner Cloud offer similar entry plans. For n8n, 1GB of RAM is the baseline. The official n8n documentation notes that heavier workflows may need 2GB. Still, a 1GB droplet handles moderate use such as email alerts, webhooks, and daily reports. Avoid plans with 512MB of RAM. n8n can become unresponsive under memory pressure.

Choose Ubuntu 22.04 LTS as the operating system. Ubuntu has a large community and current Docker packages. Most provider marketplaces let you select Ubuntu during server creation. You can use Debian 12 if you prefer. The commands in this guide assume Ubuntu. If you pick a different distribution, package manager differences will apply.

Your VPS is the foundation for everything else. Once it is live, make a note of the public IP address. You will need it for DNS and SSH. If you are unsure whether self-hosting is worth the effort, start with our n8n review. It explains what you give up compared to n8n Cloud. The next step points a domain name to this new IP address.

  1. Point a domain or subdomain to the VPS

SSL certificates need a domain name. You can use a bare domain like example.com or a subdomain like n8n.example.com. A subdomain is often cleaner because it keeps your main site separate. Log in to your DNS provider and create an A record. Point the host value, usually n8n, to your VPS public IP address. If you use Cloudflare, set the record to DNS only for now. The proxy feature can break some n8n webhook requests.

DNS changes can take a few minutes to several hours to propagate. Most providers apply them quickly. Test with a tool like dig or an online DNS checker. You want to see your VPS IP address in the answer. Do not continue until this resolves. Caddy and Let’s Encrypt need a valid DNS record to issue a certificate.

If you are setting up automations for clients, a dedicated subdomain also looks more professional. You can send webhook URLs like n8n.yourbusiness.com without exposing random ports. This step connects directly to the reverse proxy setup later. Your Docker container will know your domain through an environment variable. Keep the domain value handy because you will use it in the Docker Compose file.

  1. Install Docker and Docker Compose on Ubuntu

Docker packages n8n with all its dependencies. You avoid installing Node.js, npm, and native build tools by hand. First update your package index. Run sudo apt update and sudo apt upgrade. Then install Docker with sudo apt install docker.io docker-compose-plugin. The docker-compose-plugin gives you the modern compose syntax. After installation, check the version with docker –version and docker compose version.

Add your user to the docker group so you can run commands without sudo. Use sudo usermod -aG docker $USER. Then log out and back in. If you skip this, you must prefix every Docker command with sudo. That gets tedious. Test that Docker works with docker run hello-world. You should see a hello message if everything is correct.

Docker also gives you process isolation. n8n runs inside a container. A bad workflow cannot easily touch your server files. You can stop the container with one command. You can update by pulling a new image. If you want to explore another automation tool that does not require server management, our Make.com review covers the hosted alternative. For now, Docker is ready for the n8n configuration.

data center server rack with glowing network cables
Photo by Pexels
  1. Configure n8n with Docker Compose

Create a directory for n8n. Use mkdir ~/n8n and cd ~/n8n. Inside, create a file named docker-compose.yml. This file defines the n8n container, volumes, ports, and environment variables. The official n8n setup follows this pattern. You can find reference examples in the n8n documentation. Use the n8nio/n8n image from Docker Hub. Set the version tag to a specific release instead of latest for stability.

The compose file should include a volume for /home/node/.n8n. This stores your workflows, credentials, and settings. Map port 5678 to the container. Add environment variables for N8N_HOST, N8N_PORT, N8N_PROTOCOL, and WEBHOOK_URL. For example, set N8N_HOST to n8n.example.com, N8N_PORT to 5678, N8N_PROTOCOL to https, and WEBHOOK_URL to https://n8n.example.com. These variables tell n8n how to build webhook URLs. Without them, webhook links may use the wrong domain.

Set TZ to your timezone and GENERIC_TIMEZONE to the same value. This prevents schedule confusion. You can also set executable mode to queue for better performance. Still, default mode works fine on a $5 VPS. Once the file is saved, run docker compose up -d. Check the logs with docker compose logs -f. You should see n8n start without errors. At this point n8n is running on port 5678 but it is not yet public. You need SSL first.

computer monitor displaying an n8n workflow builder with connected nodes
Photo by Pexels
  1. Add SSL with Caddy reverse proxy

You cannot run plain HTTP for a server exposed to the internet. Credentials and webhook data would travel in clear text. Caddy solves this with automatic HTTPS. Install Caddy on Ubuntu using the official repository. Create a Caddyfile that proxies n8n.example.com to localhost:5678. When Caddy starts, it requests a free certificate from Let’s Encrypt. The certificate renews automatically.

Your DNS A record must already point to the VPS. If it does not, Caddy will fail the certificate challenge. Open ports 80 and 443 in your firewall. Most VPS providers let you manage firewall rules from the control panel. Allow SSH on port 22 as well. Then start Caddy and check the service status. Your n8n instance should now load over HTTPS.

This step matters because n8n stores credentials for connected apps. An attacker who intercepts HTTP traffic could steal API keys and webhook secrets. After SSL is active, you can also disable port 5678 in the firewall. Only the Caddy proxy on port 443 should face the public internet. The next step adds login protection. It is another layer before anyone can reach your workflows.

  1. Turn on authentication and encryption

n8n does not require login by default. Anyone who finds your URL can open the editor. Turn on basic authentication with three environment variables. Add N8N_BASIC_AUTH_ACTIVE=true, N8N_BASIC_AUTH_USER=yourname, and N8N_BASIC_AUTH_PASSWORD=yourpassword. Use a long random password. If your password is weak, bots will try common combinations. After saving the compose file, run docker compose up -d again.

Basic auth is simple but effective for single user setups. It protects the entire n8n interface and API. Still, it does not replace good password hygiene. Avoid using a password you use elsewhere. You can also restrict access by IP if you only work from one location. Many freelancers add a VPN for extra safety. The goal is to reduce attack surface.

n8n also needs an encryption key. This key encrypts stored credentials in your database. Set N8N_ENCRYPTION_KEY to a random 32 character string. Generate one with openssl rand -base64 24. Do not change this key after setup. If you change it, existing credentials cannot be decrypted. Keep the key in a password manager. With auth and encryption set, your server is much harder to compromise. If you plan to process invoices or client data, our invoice processing automation guide shows why encryption matters.

  1. Create automated backups

Your VPS can fail. A provider outage or disk error could erase your workflows. Create two kinds of backups. First, copy the ~/n8n/n8n_data directory to another location. This directory holds your full n8n database. You can use tar to compress it. Second, export workflows individually from the n8n interface or command line. The n8n CLI supports export commands that produce JSON files.

Automate backups with cron. Add a cron job that runs tar -czf n8n_backup_date.tar.gz ~/n8n/n8n_data. Then copy the file to object storage like S3 or Backblaze B2. Many providers charge about $5 per month for 100GB of storage. If you want to keep costs low, use a second VPS or your local machine. Store backups off the same server because a server failure destroys local copies too.

Test a restore before you need it. Stop n8n, restore the backup into a fresh directory, and start the container. Check that workflows and credentials appear. A backup you never test is just a hope. Also export critical workflows as JSON every week. You can import them into n8n Cloud if you ever switch. For more on building workflows that are worth backing up, see our 20 minute n8n starter guide.

  1. Connect an app and run your first workflow

Open your n8n domain in a browser. Enter the basic auth credentials you set earlier. You will see the n8n editor. Click create workflow. Add a manual trigger node and an HTTP request node. Connect them by dragging a line. This is the same pattern covered in our beginner n8n tutorial. Run the workflow and check the output. Even a simple request to a public API proves the server is working.

Next add a real integration. n8n supports more than 400 apps and services. Click add credential to connect Gmail, Slack, Notion, or Google Sheets. The credential dialogs use OAuth or API keys. Because your n8n instance uses HTTPS, OAuth callbacks work without special tricks. This is a major reason to set up SSL before connecting apps. Once a credential is active, you can build automations that react to events.

Start with a small but useful workflow. For example, watch an email inbox and post new messages to a Slack channel. Or use our email follow-up automation template to chase unpaid invoices. If you manage social accounts, try the social media cross-posting template. Self-hosting gives you the freedom to run these templates without paying per task. Your $5 VPS can handle dozens of daily workflows if you keep memory in mind.

person typing on a laptop with workflow automation dashboard on screen
Photo by Pexels

Red Flags & Warnings

  • 🚨 Do not expose n8n to the internet without Basic Auth enabled. Anyone who finds the URL can open the editor and run workflows that may modify connected apps.
  • 🚨 Avoid 512MB RAM VPS plans. n8n can consume more than 512MB during workflow execution and may crash under concurrent webhook bursts.
  • 🚨 Never skip SSL. Running n8n over plain HTTP exposes API keys, credentials, and webhook payloads to anyone monitoring the network.
  • 🚨 Do not change the n8n encryption key after you have stored credentials. A changed key makes existing encrypted data unreadable.
  • 🚨 Keep your Ubuntu server updated. Unpatched packages are the most common way attackers gain control of small VPS deployments.
  • 🚨 Watch disk space. Execution logs and n8n data can grow quickly, especially if you enable debug logging or store large webhook payloads.

Frequently Asked Questions

Can a $5 VPS really run n8n?

Yes for moderate use. A typical $5 plan has 1 vCPU and 1GB of RAM. n8n runs fine for scheduled tasks, webhooks, and light data processing. Heavier workflows with large file parsing or many parallel executions may need 2GB. Start with 1GB and monitor memory.

Do I need a domain name to self-host n8n?

Yes, a domain or subdomain is strongly recommended. Let’s Encrypt SSL requires a valid DNS name. A domain also lets you create stable webhook URLs for apps like Shopify or Slack. You can use a free domain from services like DuckDNS if you do not want to buy one.

How is self-hosted n8n different from n8n Cloud?

Self-hosted puts the server in your control. You pay a flat VPS fee instead of per month per user. n8n Cloud manages updates, backups, and security for you. Self-hosting requires you to handle those tasks. The self-hosted version has no workflow cap beyond your server resources.

How do I update n8n after self-hosting?

Change the version tag in your docker-compose.yml file. Then run docker compose pull and docker compose up -d. Check the logs for migration messages. n8n runs database migrations automatically on startup. Always back up before upgrading.

Is n8n safe to expose to the internet?

Yes if you follow security best practices. Use SSL, Basic Auth, a strong password, and an encryption key. Keep the operating system and Docker updated. Restrict access by IP or VPN if possible. These layers reduce the risk of unauthorized access.

What do I do if my VPS runs out of memory?

First stop any running workflow executions. Check memory usage with free -h and docker stats. Increase swap space temporarily. If the problem persists, upgrade to a 2GB plan. You can also move some high-volume automations to a dedicated worker.

What Should You Remember?

  • Flat $5 hosting: Replace per user automation fees with one VPS invoice.
  • Unlimited workflows: Self-hosted n8n removes the 5 active workflow free tier limit.
  • Full data control: Your workflow data and credentials stay on your own server.
  • Docker simplifies updates: Change a version tag and pull the new image.
  • SSL is not optional: Always use HTTPS to protect credentials and webhook traffic.
  • Backups prevent disaster: Automate daily data snapshots and weekly JSON exports.
  • Start with one workflow: Validate the setup before connecting multiple business apps.

This article is for general information only. Review your workflow data and the permissions you grant to connected tools before you enable automation. Some platforms have free-tier limits and paid plans that change over time , always check current pricing and plan limits on the vendor’s site before you commit.