Get started
n8n

Self-hosted n8n on Your Own VPS: Docker, Traefik and Backups

Guide to installing n8n on a VPS with Docker, Traefik and backup configuration. Step by step we discuss the setup without promises of simplifications and with emphasis on real requirements.

In this article
Self-hosted n8n on VPS with Docker, Traefik and backups
Photo: Bernd 📷 Dittrich on Unsplash

Self-hosted n8n on Your Own VPS: Docker, Traefik and Backups

The decision to run n8n on your own VPS is not a simple choice. It requires server preparation, container configuration and regular monitoring of backups. In this guide we describe the steps without omitting potential problems.

When self-hosted n8n on VPS makes sense

Before you proceed to installation, it is worth analyzing the costs. The article n8n Cloud or self-hosted? Cost calculator for the company helps compare both options. Self-hosted avoids monthly fees with a large number of executions, but transfers all responsibility to you.

In practice n8n works for building automations, including AI agents without code: Lindy vs Dify vs n8n. On your own VPS you have full access to data, which is important when processing company information. However, it is not a maintenance-free solution.

Preparing VPS for n8n

Choose a server with at least 2 GB RAM and SSD drive. Ubuntu 22.04 or newer system facilitates work with Docker. After logging in via SSH update packages with the command apt update && apt upgrade -y.

Install Docker according to the instructions from VPS providers' guides. Sources such as OVHcloud documentation emphasize that Docker and Docker Compose are the basis. Without this you will not run n8n in an isolated environment.

Also set up a domain pointed to the server IP. It will be needed for Traefik and HTTPS certificates.

Installing Traefik as reverse proxy

Traefik integrates well with Docker and automatically manages Let's Encrypt certificates. Create a traefik.yml file with configuration of entrypoints for HTTP and HTTPS and docker provider.

Then prepare docker-compose.yml with traefik service. Add volumes for configuration and certificates. Running docker compose up -d will start the proxy.

Compared to Nginx, Traefik requires less manual configuration with dynamic containers. However, test the routing rules, because errors in labels will prevent access to n8n.

n8n Configuration with Docker Compose and Postgres

Prepare a docker-compose.yml file containing services: traefik, n8n and postgres. For n8n set environment variables such as N8N_HOST=yourdomain.pl, WEBHOOK_URL=https://yourdomain.pl/ and unique N8N_ENCRYPTION_KEY.

Use volumes for n8n data persistence and the database. After docker compose up -d log in to the n8n interface. Sources like the SSDNodes guide indicate that incorrect WEBHOOK_URL causes errors in webhooks.

If you plan to use n8n for automation, consider registration via the affiliate link n8n. This tool allows self-hosting without cloud limitations.

Setting up n8n backups

Backups are the element that is most often omitted at the beginning. Configure a script copying the volumes folders to an external drive or S3. Use cron for daily execution of pg_dump for the Postgres database.

Store backups outside the server. Test restoration, because only then the backup makes sense. In self-hosted n8n data loss means loss of all workflows and configurations.

Regular updates of Docker images also require backup before changes. This is not complicated, but requires discipline.

Typical problems and their solving

Errors with Traefik certificates often result from blocking port 80 or bad domain configuration. Check logs with the command docker logs traefik. Similarly with n8n problems – docker logs n8n shows details.

Comparison with other tools you will find in the text n8n vs Make.com vs Zapier 2026 for Polish SMEs. Self-hosted requires more work, but gives flexibility with integrations.

Summing up, the installation works if you perform the steps one by one. However, it is not an option for someone who does not want to manage the server.

Frequently asked questions

Is Traefik required to install n8n on a VPS?
It is not required, but it facilitates HTTPS management and integrates with Docker. You can use Nginx, but then the configuration is more manual.
How often to make n8n backups?
Daily for the database and weekly full backup of volumes. Test restoration, because without it the backup has no value.
Is self-hosted n8n suitable for AI agents?
Yes, n8n allows building AI agents without code. On VPS you have more control over computing resources.
How much RAM does n8n need on a VPS?
Minimum 2 GB, but with complex workflows with many integrations better 4 GB or more.
What to do when webhooks in n8n do not work?
Check the correctness of WEBHOOK_URL and N8N_HOST in environment variables. Often the problem lies in the configuration of Traefik or firewall.

Sources

  1. How to install n8n on an OVHcloud VPSdocs.ovhcloud.com
  2. Jak zainstalować n8n na VPS przez Dockerssdnodes.com
  3. Moduł 1: Instalacja i hosting n8n - Cloud, Docker, VPS, HTTPS ...kursn8n.pl

Work with us

Want these numbers for your company?

Tell me which processes you want to automate. You get a concrete recommendation and a price range — on terms that are the same for every client.

50/50payment: start / delivery
60 dayswarranty on the rollout
from 4,900 PLNnet, first automation

Ask about a rollout

No strings attached. You are writing to Karol, not to a form.

Prefer a call? Book 15 minutes →

Related posts

All posts →