---
title: "Install n8n on a VPS: Self-Hosted Workflow Automation with HTTPS"
description: "**In short**n8n is an open-source automation tool that connects your apps. On a VPS you own, you run unlimited workflows with no per-execution fees. You need **Docker**, a **subdomain** and a **docker-compose** file with n8n and Caddy for automatic HTTPS.…"
url: "https://www.hyyat.com/en/knowledgebase/install-n8n-on-vps/"
updated: "2026-11-28"
category: Server management / Servers Without a Control Panel
---

# Install n8n on a VPS: Self-Hosted Workflow Automation with HTTPS

**In short**n8n is an open-source automation tool that connects your apps. On a VPS you own, you run unlimited workflows with no per-execution fees. You need **Docker**, a **subdomain** and a **docker-compose** file with n8n and Caddy for automatic HTTPS. A **4GB** plan is comfortable for most businesses.

![Installing n8n on a VPS](https://www.hyyat.com/wp-content/uploads/2026/11/hkb-vu-hero-vu-n8n-en.webp)

n8n connects apps such as Google Sheets, WhatsApp Business, email and your online store, and runs repetitive tasks for you: a new store customer is added to a sheet, you get a message, and a welcome email goes out. The cloud version is billed per execution; on your own server the only limit is the server's resources, and your data stays with you.

## Choosing resources

| Use | Suitable plan | Why |
| --- | --- | --- |
| Testing and a few workflows | VPS 2GB | n8n alone needs 1 to 2 GB of memory |
| A business with dozens of workflows | VPS 4GB | Room for parallel executions and PostgreSQL |
| Large files or AI steps | VPS 8GB | Big files and requests use memory |

## Before you start

- A VPS with Ubuntu 24.04 or Debian 12 and root SSH access.
- Point a subdomain (for example `n8n.example.com`) to the server IP with an A record and wait for it to resolve.
- In the firewall, open only ports 22, 80 and 443 and keep the rest closed.

## 1. Install Docker

```
curl -fsSL https://get.docker.com | sh
systemctl enable --now docker
docker compose version
```

## 2. Create the project files

```
mkdir -p /opt/n8n && cd /opt/n8n
```

Create `docker-compose.yml` with this content, changing the domain and time zone:

```
services:
  n8n:
    image: docker.n8n.io/n8nio/n8n
    restart: unless-stopped
    environment:
      - N8N_HOST=n8n.example.com
      - N8N_PROTOCOL=https
      - WEBHOOK_URL=https://n8n.example.com/
      - GENERIC_TIMEZONE=Asia/Riyadh
      - TZ=Asia/Riyadh
    volumes:
      - n8n_data:/home/node/.n8n
  caddy:
    image: caddy:2
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./Caddyfile:/etc/caddy/Caddyfile
      - caddy_data:/data
volumes:
  n8n_data:
  caddy_data:
```

Then a `Caddyfile` in the same folder:

```
n8n.example.com {
    reverse_proxy n8n:5678
}
```

## 3. Start n8n

```
docker compose up -d
docker compose logs -f n8n
```

Open `https://n8n.example.com` and create the owner account straight away, because whoever opens the page first becomes the owner. Caddy obtains the SSL certificate automatically, with no extra setup.

## Updates and backups

```
cd /opt/n8n
docker compose pull && docker compose up -d
```

n8n data (workflows and encrypted credentials) lives in the `n8n_data` volume. Take a **snapshot** from the VPS control panel before every update, and export important workflows from n8n from time to time.

 **A mistake to avoid:** Exposing n8n on port 5678 to the internet without HTTPS. Credentials for your connected accounts pass through it, so always keep it behind Caddy or another proxy with SSL. **At Hyyat Host:** NVMe VPS servers with full root access, ready for n8n in minutes: [VPS plans](https://www.hyyat.com/en/vps-hosting/), with our own control panel for power, console and snapshots, and Arabic and English support.

## Frequently asked questions

   Is n8n free on my own server?

The community edition is open source and free to self-host under its licence terms; you only pay for the server.

   How many workflows can I run?

n8n itself sets no limit; the limit is the server's memory and CPU. Start with a 4GB plan and upgrade when needed.

   Do I need PostgreSQL?

n8n runs on its built-in SQLite database, which is fine for light use. With many executions, move to PostgreSQL for better stability.

   **Related guides**

- [New VPS Setup Commands, Step by Step](https://www.hyyat.com/en/vps-setup-script/)
- [Docker Compose Generator for WordPress and Apps](https://www.hyyat.com/en/docker-compose-generator/)
- [Firewall: Control the Open Ports on Your VPS](https://www.hyyat.com/en/knowledgebase/vps-firewall-manage-open-ports/)
- [When Should You Move from Shared Hosting to a VPS? 7 Clear Signs](https://www.hyyat.com/en/knowledgebase/when-to-move-from-shared-hosting-to-vps/)

[All guides for servers without a panel →](https://www.hyyat.com/en/kb/servers-without-control-panel/)

  **Need this service from Hyyat Host?**Our team handles it for you, with support replying to tickets within 24 hours at most.[Server Management](https://www.hyyat.com/en/server-management/)
