How to self-host n8n on a VPS

You can self-host n8n on a Virtual Private Server to run your own AI workflow automation platform. This configuration takes about thirty minutes from provision to first active workflow.

Prerequisites

Our read: Before you touch the command line, make sure your domain records are fully propagated. Waiting for Domain Name System propagation halfway through an installation causes unnecessary SSL certificate failures and forces you to rebuild your reverse proxy blocks.

Pick a Virtual Private Server provider with reliable block storage and easy snapshot backups. You want the ability to roll back the entire instance instantly if a package update breaks your container runtime dependencies.

  • A running Virtual Private Server instance
  • Administrative access via secure shell
  • A registered domain name pointed to your server Internet Protocol address

Install and connect

Deploying the container requires patience and strict attention to your environment variables. Do not skip setting your host address correctly, or your webhook URLs will fail to resolve when external services try to trigger your automations.

Keep your configuration files in a dedicated directory so you can back them up regularly. If you lose your encryption key file, you will permanently lose access to stored credentials inside your workflows.

  1. Connect to your Virtual Private Server using secure shell.
  2. Install Docker and Docker Compose following the official package repository instructions for your operating system.
  3. Create a dedicated directory for your n8n project files and navigate into it.
  4. Create a compose file defining your container service and environment variables.
  5. Start the container in detached mode using Docker Compose.

Settings that matter and why

Adjusting your execution data retention setting is the single most important action you can take to prevent your server storage from filling up overnight. By default, n8n keeps every execution history item, which will quickly consume all available disk space on a standard Virtual Private Server.

Set your timezone explicitly in the environment variables rather than relying on the container default. Otherwise, scheduled nodes and cron triggers will execute hours off from your expected local time, causing silent data processing failures.

  • Execution data retention settings
  • Environment variables for webhook URLs
  • Timezone configuration to match your local schedule

Verify it worked

Check your container logs immediately if the web interface fails to load. The logs will tell you instantly whether the process crashed due to a missing environment variable or a port conflict with another service.

Do not leave the initial setup screen sitting idle for too long. Complete the owner account creation immediately to lock down the instance against unauthorized administrative access.

  1. Run the container status command to confirm the service is healthy.
  2. Open your web browser and navigate to your configured domain.
  3. Complete the owner account registration form on the welcome screen.
  • HTTP status checks for the container service
  • Browser access to the configured domain name
  • Creation of the initial owner account

How to undo it

If your self-hosted installation fails completely, destroying the container volumes is the fastest way to start fresh. Do not attempt to salvage a corrupted database when you can redeploy the entire stack in under five minutes.

Always back up your database volume before running major software updates so you have a clean recovery path if the migration script fails.

  1. Run the compose down command with volume removal flags to clear all data.
  2. Delete the project folder from your server filesystem.
  3. Purge unused Docker images and networks to reclaim disk space.
  • Stop and remove running containers
  • Delete the project directory and stored volumes
  • Remove DNS records if decommissioning permanently

How we verified this

Evidence level: Researched from official sources. TNTReview did not test this product directly. Every factual claim above comes from the official sources listed here.

Last verified: 2026-09-22

Leave a comment