Test your skills on our all Hosting services and get 15% off!

Use code at checkout:

Skills
24.09.2025

How to Deploy n8n on Debian 12 VPS

Running n8n on your own VPS is the best way to build secure, scalable, and always-on automation workflows. Unlike cloud-based automation services, hosting n8n on an AlexHost VPS gives you full data privacy, unlimited executions, 24/7 uptime, and predictable costs. With Debian 12 as the base OS, you’ll benefit from long-term stability and modern software support.

This guide will walk you through installing Docker, configuring n8n with encryption, launching the service, and accessing it in the browser.

Why Run n8n on a VPS Instead of Just in the Browser?

While n8n offers a cloud service accessible directly from the browser, running your own n8n instance on a VPS provides critical advantages for professionals, businesses, and developers:

  • Full Data Privacy – All your workflows, API keys, and customer data remain entirely under your control. No third-party provider can access your information.
  • Unlimited Integrations – On a VPS you set the limits, not the SaaS provider. You can run as many workflows, triggers, and executions as needed.
  • 24/7 Availability – A VPS keeps your automations online at all times, even when your personal computer is off.
  • Better Security – Protect your system with firewalls, SSL certificates, and VPN access. All credentials are encrypted with your own key.
  • Scalability and Performance – With AlexHost VPS, you can upgrade CPU, RAM, and storage resources whenever your automation projects grow.
  • Cost-Effective – Instead of paying per execution, you pay a fixed monthly VPS fee and run unlimited workflows.

👉 In short: Running n8n on your VPS transforms it into a powerful self-hosted automation hub where you control the data, performance, and costs.

Update the Server

Always start by updating Debian 12 packages:

sudo apt update && sudo apt upgrade -y

Output explanation: You’ll see packages being downloaded and upgraded. At the end, the system confirms with 0 upgraded, 0 newly installed if everything is already up to date.

Install Docker and Docker Compose

Install dependencies and add Docker’s official repository:

sudo apt install -y curl gnupg2 ca-certificates lsb-release apt-transport-https
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Update repositories and install Docker + Compose:

sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin

Check versions:

docker --version
docker compose version

📌 Output example:

Docker version 25.0.3, build abc123
Docker Compose version v2.24.6

This confirms Docker is installed and ready.

Prepare the Project Directory

Create a dedicated directory for n8n:

mkdir ~/n8n && cd ~/n8n

Generate an Encryption Key

This key is used to encrypt credentials inside n8n:

openssl rand -base64 24 > ~/n8n/encryption.key

cat ~/n8n/encryption.key

 

Create the docker-compose.yml

Open the file:

nano docker-compose.yml

Paste the configuration (replace YOUR_SERVER_IP with your AlexHost VPS IP):

version: '3.7'

services:
  n8n:
    image: n8nio/n8n:latest
    restart: always
    ports:
      - "5678:5678"
    environment:
      - N8N_BASIC_AUTH_ACTIVE=true
      - N8N_BASIC_AUTH_USER=admin
      - N8N_BASIC_AUTH_PASSWORD=supersecretpassword
      - GENERIC_TIMEZONE=Europe/Chisinau
      - N8N_ENCRYPTION_KEY_FILE=/files/encryption.key
      - N8N_EDITOR_BASE_URL=http://YOUR_SERVER_IP:5678
      - N8N_SECURE_COOKIE=false
    volumes:
      - ./n8n_data:/home/node/.n8n
      - ./encryption.key:/files/encryption.key:ro

Save (CTRL + O, Enter) and exit (CTRL + X).

Adjust Permissions

Give the container user proper rights:

mkdir -p ./n8n_data
sudo chown -R 1000:1000 ./n8n_data

Start n8n

Run the container in detached mode:

docker compose up -d

Output example will be like:

[+] Running 2/2
✔ Network n8n_default Created
✔ Container n8n-n8n-1 Started

Check running containers:

docker ps

Output will be like following:

Verify Logs

Make sure there are no errors:

docker logs -f n8n-n8n-1

📌 What to expect:

  • No “mismatching encryption keys” errors.
  • Service confirming startup and listening on port 5678.

Output will be like following:

Access n8n in the Browser

Now open your VPS IP in a browser:

http://YOUR_SERVER_IP:5678
If you want to output to your server, or there is no way to check on your browser, you can enter this using curl
curl http://176.123.2.191:5678
This output comes from running curl against your n8n instance on port 5678. Instead of rendering the visual editor, it shows the raw HTML source of the n8n login page, including <script> tags and a warning that the UI requires JavaScript. In short, this confirms that n8n is working correctly, but since curl cannot execute JavaScript, you must open the same URL in a real browser to use the n8n Editor. And in the browser itself you will be able to see this window.

This is the n8n Owner Account Setup screen, which appears when you access your n8n instance for the first time in a browser. It allows you to register the initial administrator by entering an email, first name, last name, and a secure password. Once completed, this account becomes the main owner of your n8n deployment, giving you full access to the editor and workflow management. After filling in the form and clicking Next, you can begin creating and managing automation workflows directly in the n8n visual interface.

Conclusion

This guide clearly shows how to deploy n8n on an AlexHost VPS with Debian 12 and highlights why it’s a superior choice over browser-based usage. Running n8n on your own VPS ensures full control of data, unlimited workflows, and continuous 24/7 uptime, which is essential for professional automation. The installation process with Docker and Docker Compose is straightforward, making it easy to set up a secure and scalable automation hub. Using AlexHost VPS resources allows smooth scalability of CPU, RAM, and storage as projects grow. Security is reinforced with encryption keys, SSL options, and private authentication. In conclusion, deploying n8n on an AlexHost VPS combines stability, privacy, and cost-efficiency, turning your server into a powerful self-hosted automation platform.

Test your skills on our all Hosting services and get 15% off!

Use code at checkout:

Skills