Knowledgebase

Self-Hosting n8n on a Zenbyte Cloud VPS

This guide explains how to self-host n8n on a Cloud VPS. The setup uses:

  • Caddy as a reverse proxy to expose n8n securely to the internet

  • Docker Compose to define and run all required services

This approach is suitable for users who want full control over their n8n environment on their own VPS.


Prerequisites & Required Knowledge

Self-hosting n8n requires solid technical knowledge, including:

  • Linux server administration

  • Docker and Docker Compose

  • Resource management and scaling

  • Securing servers and web applications

  • Configuring and maintaining n8n


Stable and Beta Versions

n8n releases new versions frequently:

  • Stable version – recommended for production use

  • Beta version – contains the latest features but may be unstable

Use the stable version for live environments. Issues with beta versions should be reported via the official n8n community forum.


Create a Cloud VPS

  1. Log in to your VPS control panel

  2. Create a new Cloud VPS or select an existing project

  3. Choose a Linux distribution that supports Docker (Ubuntu LTS is recommended)

  4. If available, select a Docker-enabled image

VPS Size

For most use cases, an entry-level or mid-range Cloud VPS with sufficient CPU and memory is adequate. n8n scales well, but heavier workflows require more resources.

Authentication

Use SSH key authentication instead of password login for better security.
This guide assumes SSH access is enabled.


Log in to the Server

Connect to your VPS using SSH from a terminal:

 
ssh root@<your-server-ip>

Install Docker Compose

If Docker Compose is not installed, update the system and install it:

 
apt update && apt -y upgrade apt install docker-compose-plugin

Verify installation:

 
docker compose version

Clone the Configuration Repository

This setup uses a ready-made Docker Compose configuration for n8n and Caddy.

Clone the repository:

 
git clone https://github.com/n8n-io/n8n-docker-caddy.git cd n8n-docker-caddy

Default Folders and Files

The configuration includes two important folders that will be mounted into Docker containers:

  • caddy_config – contains the Caddy configuration

  • local_files – stores files uploaded or generated by n8n

These ensure data persists outside the containers.


Create Docker Volumes

Create a volume for Caddy data (TLS certificates, cache):

 
docker volume create caddy_data

Create a volume for n8n data:

 
docker volume create n8n_data

Set Up DNS

n8n typically runs on a subdomain, for example:

 
n8n.example.com

Create an A record with your DNS provider that points the subdomain to your VPS IP address.


Open Required Ports

n8n is accessed via HTTP and HTTPS. Make sure the firewall allows:

  • Port 80 (HTTP)

  • Port 443 (HTTPS)

If using UFW:

 
ufw allow 80 ufw allow 443

Configure n8n Environment Variables

n8n uses environment variables defined in the .env file.

Open the file:

 
nano .env

Replace the placeholder values with your own configuration.
Inline comments explain each variable.

For a complete list of available options, refer to the official n8n Environment Variables documentation.


Docker Compose Configuration

The docker-compose.yml file defines two services:

  • Caddy

    • Exposes ports 80 and 443

    • Manages HTTPS certificates automatically

  • n8n

    • Runs the n8n application

    • Uses environment variables from .env

    • Stores data in persistent volumes

You normally do not need to edit this file, but you can review it:

 
nano docker-compose.yml

Configure Caddy

Edit the Caddy configuration file:

 
nano caddy_config/Caddyfile

Replace the placeholder domain with your own subdomain:

 
n8n.yourdomain.tld { reverse_proxy n8n:5678 { flush_interval -1 } }

This tells Caddy to forward incoming traffic to the n8n container.


Start n8n and Caddy

Start the services:

 
docker compose up -d

Initial startup may take a few minutes, especially while SSL certificates are issued.


Test the Installation

Open your browser and go to:

 
https://n8n.yourdomain.tld

Log in using the credentials defined in the .env file.
If everything is configured correctly, the n8n interface will load.


Stop the Services

To stop n8n and Caddy:

 
docker compose stop

Updating n8n

To update n8n when using Docker Compose:

 
# Navigate to the compose directory cd /path/to/n8n-docker-caddy # Pull the latest images docker compose pull # Stop and remove old containers docker compose down # Start updated containers docker compose up -d

Final Notes

  • Always back up your n8n data before upgrading

  • Monitor server resources for growing workflows

  • Secure your VPS properly (firewall, SSH hardening, updates)

This setup gives you full control over your n8n environment on your Zenbyte Cloud VPS.

  • n8n, Cloud VPS

Was this answer helpful?

0 Users Found This Useful

Related Articles

No Articles Found