n8n on a VPS: Self-Hosted Workflow Automation Setup Guide

Rajdeep Singh

Last Updated:

hero-image

If you’ve spent any time exploring automation tools recently, you’ve likely come across n8n workflow automation. It has quickly become one of the fastest-growing tools in the self-hosted ecosystem, and not just because it’s open source. 

It delivers everything platforms like Zapier and Make offer, but with one key difference: you control the infrastructure, the data, and the cost. That’s a big shift. Instead of paying monthly fees based on how many tasks you run, you can host n8n yourself and remove those limits entirely. 

Same workflows, same features – just without the restrictions. The only cost here is that you have to host it yourself. The silver lining? It's a much simpler process than you'd imagine; by the end of this section, you should have the direction and the confidence to get n8n self-hosted working without having a background in DevOps.

What is n8n?

n8n is an open source workflow automation tool for connecting any apps, APIs, and services. It enables you to build automated workflows using a node-based interface in a visual manner. 

  • Visual workflow builder to design automation easily

  • Supports integrations with apps, APIs, and databases

  • Allows custom logic using JavaScript

  • Can be self-hosted on a VPS for full control and unlimited usage

What Does It Replace?

n8n is commonly used as an alternative to tools like Zapier and Make. These platforms help automate workflows but often come with usage limits and ongoing costs. As automation needs grow, these limitations can become restrictive.

  • Replaces task-based automation tools with unlimited workflows

  • Removes dependency on third-party cloud platforms

  • Eliminates per-task or execution-based pricing

  • Offers more flexibility for building complex workflows

n8n vs. Zapier vs. Make

The determining factors in deciding between the different automation tools come down to: cost, flexibility, and control. Zapier & Make build their software to be as straightforward as possible, whereas n8n offers choices when constructing automations for greater scalability and flexibility. Usually, this becomes clearer as you automate.

Feature

n8n (Self-Hosted)

Zapier

Make

Pricing

VPS cost only

Subscription-based

Subscription-based

Execution limits

Unlimited

Plan-based

Plan-based

Custom logic

Full support

Limited

Moderate

Hosting

Self-hosted

Cloud only

Cloud only

Data control

Full ownership

Vendor-controlled

Vendor-controlled

 

Why Self-Host n8n on a VPS?

Self-hosting n8n on a VPS gives you complete ownership of your automation setup. The platform limitations or payment tier do not apply here. Everything is running/hosted on your infrastructure; it is scalable over the long-run as automation requirements evolve and fully customizable.

Internal systems, private APIs, and external services are integrated for free. That's where n8n excels for individual developers and businesses in growth. You can scale your setup without your cost increasing according to usage. If you’re exploring what else a VPS can handle beyond automation, check out this guide on VPS use cases to understand its broader potential.

Monthly Cost Breakdown

Factor

n8n Cloud (Managed)

Self-Hosted on VPS

Monthly cost

Fixed subscription (~€60/month)

VPS cost only (much lower)

Workflow executions

Limited by plan

Unlimited

Active workflows

Restricted

Unlimited

Cost scalability

Increases with usage

Remains predictable

Data control

Managed by provider

Fully controlled by you

Customization

Limited

Full flexibility

 

Control, Privacy, and Customization

Self-hosting n8n gives you complete control over your workflows and infrastructure. All data stays on your own server, making it easier to manage sensitive information and internal processes. You are not dependent on third-party platforms for storage or execution. It gives you more confidence and flexibility in how your automation runs.

It also improves privacy and allows deeper customization. You can install custom nodes, connect private APIs, and build workflows without restrictions. As your needs grow, you can scale and modify your setup easily. This makes self-hosted n8n a flexible and long-term solution.

When Self-Hosting is Not the Right Call?

  • When you want a quick, no-setup solution with minimal effort

  • When you are not comfortable managing a VPS or using the command line

  • When your automation needs are very small or occasional

  • When you prefer built-in support and managed infrastructure

  • When you don’t want to handle updates, backups, or maintenance

  • When time and convenience matter more than cost savings

Prerequisites and Recommended VPS Specs for n8n

Before setting up n8n, make sure you have the following in place:

  • A Linux VPS running Ubuntu 22.04 LTS or 24.04 (other distributions work, but these are best supported)

  • Root or sudo SSH access to your server

  • A registered domain name with DNS control

  • Basic familiarity with command-line operations

One important detail many users miss is the virtualization type. n8n’s Docker setup requires a VPS with KVM virtualization. It is also not reliable to use a Docker container with OpenVZ due to the limits of its kernel. So, we opt for a KVM VPS with allocated resources and NVMe storage.

Minimum vs. Recommended VPS Specifications

Use Case

vCPU

RAM

Storage

Light (< 10 workflows)

1

2 GB

20 GB NVMe

Small team (recommended)

2

4 GB

40+ GB NVMe

Heavy usage / AI workflows

4+

16 GB+

80+ GB NVMe

Performance is very dependent on the storage used. N8n frequently writes data (results of the executed tasks) to its database, and it can become large. Faster disk speeds improve workflow execution, UI responsiveness, and backup performance. This becomes especially important as usage increases.

Software Prerequisites

Before installing n8n, ensure the following software and configurations are ready:

  • Docker and Docker Compose — the recommended way to deploy and manage n8n

  • A domain or subdomain pointed to your VPS IP (for example, n8n.yourdomain.com)

  • Open ports 80 and 443 in your firewall for web traffic and SSL

If you’re new to container setups, you can follow this Docker on VPS guide to get everything installed correctly. 

How to Install n8n on a VPS with Docker Compose?

Step 1: Update the Server and Install Docker

Once logged in to your VPS via SSH, update your system packages. This step is crucial before installing new software for maximum security and compatibility. This step also prevents common installation issues later.

sudo apt update && sudo apt upgrade -y

Next, install Docker and Docker Compose. Docker allows you to run n8n in an isolated container, while Docker Compose helps you manage that container easily. The official Docker installation script is the safest way to get the latest version.

curl -fsSL https://get.docker.com | sudo sh

sudo usermod -aG docker $USER

Once installed, log out and log back in for the group changes to take effect, then verify that both tools are working correctly before moving forward.

docker --version

docker compose version

If both commands return version numbers, your Docker setup is ready.

Step 2: Create the n8n Project Directory and Docker Compose File

Create a dedicated folder for your n8n setup to keep files organized. This is the location for configuration files and your data, which is to be persistent across restarts. This simplifies the process of updating and taking backups, and also ensures less confusion.

mkdir ~/n8n && cd ~/n8n

Inside this folder, create a docker-compose.yml file to define your setup. This file controls how n8n runs, including ports and environment settings. It also ensures your workflows and data are saved properly. A correct configuration here is key to a stable setup.

services:

  n8n:

image: docker.n8n.io/n8nio/n8n

restart: unless-stopped

ports:

   - "127.0.0.1:5678:5678"

environment:

   - N8N_HOST=n8n.yourdomain.com

   - N8N_PROTOCOL=https

   - N8N_PORT=5678

   - WEBHOOK_URL=https://n8n.yourdomain.com/

   - GENERIC_TIMEZONE=Asia/Kolkata

   - N8N_BASIC_AUTH_ACTIVE=true

   - N8N_BASIC_AUTH_USER=admin

   - N8N_BASIC_AUTH_PASSWORD=your-strong-password

volumes:

   - n8n_data:/home/node/.n8n

volumes:

  n8n_data:

Replace n8n.yourdomain.com with your actual domain and update the password to something secure. The setup is now ready to launch.

Step 3: Set Up a Reverse Proxy and SSL Certificate

To make your n8n instance production-ready, set up a reverse proxy like Nginx or Caddy. This allows you to access n8n via a domain rather than a raw IP address. It also improves usability and provides a cleaner interface. A reverse proxy acts as a secure entry point to your application.

Caddy is the simplest option since it handles SSL certificates automatically. Install it with the following commands:

sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https

curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg

curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list

sudo apt update && sudo apt install caddy

Next, edit the Caddy configuration file at /etc/caddy/Caddyfile and add the following:

n8n.yourdomain.com {

reverse_proxy 127.0.0.1:5678

}

Then reload Caddy to apply the changes:

sudo systemctl reload caddy

Caddy will automatically request and renew an SSL certificate from Let's Encrypt. Secure connections are required for most webhook integrations to work properly. HTTPS also protects your data and improves trust with external services. This step ensures your n8n setup is both secure and reliable.

Step 4: Launch n8n and Complete First-Run Setup

Once the configuration has been completed, start n8n with the following Docker Compose command:

docker compose up -d

The container will run in the background, allowing access to n8n. You can verify it is running correctly by checking the logs:

docker compose logs -f n8n

You should now open your domain in your browser (for example, https://n8n.yourdomain.com) and ensure n8n is loading correctly.

The first time you open this address, you will be prompted to create an n8n administration account, which can be used to administer the workflow system and its settings. Once the account has been created, you are ready to begin developing and testing workflows. Run a test and ensure the system is running correctly.

Basic Maintenance: Keeping Your Self-Hosted n8n Healthy

How to Update n8n to the Latest Version

Updating n8n ensures you get the latest features, improvements, and security fixes. Since n8n runs in a Docker container, updates are quick and easy to perform. You don’t need to reinstall anything or change your setup. The process is smooth and takes only a few minutes.

All you need to do is pull the latest Docker image and restart the container. Your existing workflows and data remain safe during the update. It’s a good practice to check for updates regularly. Keeping your instance updated helps avoid bugs and compatibility issues.

Backing Up Your n8n Instance

Backing up your n8n data is essential to prevent loss of workflows and credentials. All important data is stored in your n8n data directory. If something goes wrong, a backup ensures you can quickly restore your setup. This step is critical for long-term reliability.

You can create backups manually or automate them using cron jobs. Backing up your files to a remote location makes them even safer. Besides, backing up your data regularly lowers the risk and gives you peace of mind. It is one of the easiest but most important things to do to keep things running.

Monitoring and Log Access

Monitoring helps you understand how your n8n instance is performing over time. It allows you to identify issues like slow workflows or high resource usage. Regular checks ensure everything is running as expected. This helps maintain stability and performance.

You can use Docker logs to view real-time activity and errors. Logs are useful for debugging failed workflows or connection issues. Checking logs occasionally helps you catch problems early. It’s a simple way to keep your system under control.

Security Hardening Essentials

Securing your n8n setup is important, especially when it is exposed to the internet. Basic steps like using strong passwords and enabling HTTPS go a long way. These measures protect your workflows and connected services. Security should always be a priority.

You should also limit open ports and keep your server updated regularly. Using firewall rules adds another layer of protection. Regular security checks help prevent unauthorized access. A secure setup ensures your automation runs safely.

Common Issues with n8n Hosting on VPS and How to Fix Them

Webhooks Not Firing

Regardless of your clean install, you may encounter some of the problems while running n8n on a VPS. A non-triggering webhook often boils down to your domain configuration and SSL. Lots of external services need a working HTTPS endpoint when sending data, and it will fail to call your webhook URL if it’s wrong or if your domain doesn’t use HTTPS. 

Verify that your domain name points to your VPS correctly and that HTTPS is functioning properly. Check your webhook URL for correctness with respect to your setup, and restart n8n once you do that. Then your webhooks should trigger.

Cannot Connect to Docker daemon

This error typically occurs when Docker is not running or your user does not have permission to access it. It can happen right after installation or after a server restart. Without Docker running, n8n cannot function. So this issue needs immediate attention.

Start by checking if the Docker service is active on your server. If permissions are the issue, ensure your user is added to the Docker group. Logging out and back in usually resolves it. Once fixed, Docker commands should work normally.

n8n Container Keeps Restarting 

If the n8n container keeps restarting, it usually indicates a configuration or resource issue. Incorrect environment variables or missing settings can cause crashes. In some cases, low memory can also lead to instability. This needs to be checked carefully.

Review the container logs to identify the exact error. Fix any configuration mistakes and ensure required variables are set correctly. If needed, upgrade your VPS resources. Once resolved, the container should run smoothly without restarting.

SSL Certificate Not Issuing

If you cannot obtain your SSL certificate, usually this problem has to do with DNS or firewalls. Let's Encrypt needs your domain to resolve correctly, and it needs port 443 open to prove that you own the domain. If any of this is not configured, it will not be possible to get a certificate. This is very often one of the first configuration issues that arise.

Check your domain for the correct IP address and ensure that ports 80 and 443 are open. Let some time pass if you made any changes. Restart your proxy service after fixing issues. Once everything is correct, the certificate should be issued successfully.

Is Self-Hosting n8n Worth It? The Honest Answer

Self-hosting n8n becomes a strong choice once automation needs start growing. It removes execution limits, reduces long-term costs, and gives full control over data. Instead of paying monthly based on usage, everything runs on your own VPS. This makes it a practical option for scaling workflows without restrictions.

At the same time, it comes with some responsibility. You need to handle updates, backups, and basic server maintenance. With Docker, these tasks remain simple and do not take much time. A basic understanding of server management is usually enough to handle it smoothly.

Managed options may still feel easier for very small use cases or beginners. However, as workflows increase or costs start adding up, self-hosting becomes more valuable. It offers flexibility and control that cloud platforms cannot match.

The Bottom Line

n8n workflow automation is one of the most effective ways for teams to scale automation without increasing costs. A self-hosted setup removes execution limits and gives you complete control over your workflows and data. Running n8n on your own VPS also allows you to customize and scale your automation based on your specific needs.

This is not merely a cost issue; this is about possession. And flexibility. If you deploy using Docker, the ease of setup and maintenance remains accessible and very simple. The most long-term effective, easy to manage, and independent solution is available for developers and small teams.

If you’re planning to get started, choosing the right infrastructure is essential. HostSailor’s KVM VPS NVMe provides reliable performance, fast storage, and full compatibility with Docker. It creates a strong foundation to run n8n efficiently, securely, and without limitations.

Frequently Asked Questions About n8n Hosting on VPS

Is n8n really free forever when self-hosted?

Yes, n8n can be self-hosted without paying for the software itself. You only need to cover the cost of your VPS and infrastructure. There are no execution limits or per-task charges when you run it on your own server.

Can n8n handle AI agents and LLM workflows on a VPS?

Yes, n8n supports integrations with AI tools and external APIs, making it suitable for LLM workflows. You can build automation that connects with AI services and handles complex logic. Performance will depend on your VPS resources and workload.

How many workflows can a single VPS handle?

The number of workflows depends on your server specifications and their complexity. A VPS with 4 GB RAM can handle multiple active workflows comfortably. As usage grows, you can scale resources to maintain performance.

What happens to my running workflows when n8n restarts or the VPS reboots?

Workflows running at the time of a restart may stop and not resume automatically. Scheduled workflows will continue from their next trigger cycle. If configured with Docker, n8n will restart automatically after a reboot.

Should I use SQLite or PostgreSQL with self-hosted n8n?

SQLite is a good option for small setups and individual users. PostgreSQL is better suited for larger workloads and team environments. It provides better performance and scalability as your usage increases.

Can I migrate my existing workflows from n8n Cloud to a self-hosted instance?

Yes, workflows can be exported from n8n Cloud and imported into your self-hosted setup. You will need to reconfigure credentials for security reasons. The migration process is simple and does not require rebuilding workflows.

 

Reliable Hosting You Can Trust

Experience lightning-fast, secure hosting that easily scales as your business grows, empowering you to succeed online effortlessly.

Start Hosting Now

Join Our Newsletter

Your information will never be Shared with third parties, and you can unsubscribe from our updates at any time.