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?
How often to make n8n backups?
Is self-hosted n8n suitable for AI agents?
How much RAM does n8n need on a VPS?
What to do when webhooks in n8n do not work?
Sources
- How to install n8n on an OVHcloud VPSdocs.ovhcloud.com
- Jak zainstalować n8n na VPS przez Dockerssdnodes.com
- Moduł 1: Instalacja i hosting n8n - Cloud, Docker, VPS, HTTPS ...kursn8n.pl