n8n on Debian 12 (Docker Compose + Nginx + SSL)

n8n is an open-source workflow automation platform that enables you to connect applications, APIs, and databases to create powerful automated workflows — all through an intuitive, visual interface. Comparable to Zapier or Make (Integromat), n8n gives developers and teams full control over data and execution by being self-hosted, privacy-friendly, and infinitely customizable.

Running n8n on Debian 12 (Bookworm) provides a stable, secure, and production-ready foundation. Debian 12 includes systemd 252, OpenSSL 3, and modern Docker Engine support, making it ideal for hosting n8n with Docker Compose, Nginx reverse proxy, and SSL encryption — ensuring both performance and data security.


Architecture Overview

LayerComponentRole
OSDebian 12 (Bookworm)Stable and secure Linux base
RuntimeDocker Engine + ComposeRuns n8n and supporting services in containers
DatabasePostgreSQL / SQLiteStores workflow configurations, executions, and credentials
Applicationn8n Server (Node.js)Core automation engine and web UI
Reverse ProxyNginxHandles HTTPS, routing, and compression
TLSLet’s Encrypt / PKIProvides secure HTTPS for webhooks and the dashboard

Why Use n8n?

  • Open-source Zapier alternative – host your own workflow automation system.
  • Visual builder – drag-and-drop interface for workflows and logic automation.
  • Extensible integrations – over 400 prebuilt nodes for APIs, CRMs, and services.
  • Self-hosted and private – full control of your workflows and data.
  • Scalable and flexible – supports PostgreSQL, Redis, and load balancing.
  • Developer-friendly – create custom JavaScript nodes or REST integrations easily.

n8n vs Other Automation Platforms

Feature/Capabilityn8n (Self-hosted)Zapier (Cloud)Make (Cloud)Node-RED (Self-hosted)
HostingSelf-hostedSaaS onlySaaS onlySelf-hosted
CostFree, open-sourceSubscriptionSubscriptionFree, open-source
Integrations400+5000+1500+100+
ExtensibilityHigh (custom nodes)LimitedLimitedHigh (custom JS)
PrivacyFull controlCloud storageCloud storageLocal only
Best forDevelopers / SMEsNon-technical usersSMBsEngineers

n8n stands out as the ideal solution for teams who want powerful automation with complete data ownership and no vendor lock-in.


Security & Best Practices

  • Run n8n behind Nginx with HTTPS enabled.
  • Store credentials in .env or Docker secrets (never hardcoded).
  • Use strong authentication or enable basic auth on the dashboard.
  • Keep Debian, Docker, and n8n containers updated regularly.
  • Limit external access to ports 80 and 443 using UFW or nftables.
  • Schedule database backups for PostgreSQL or persist SQLite volumes.
  • Restrict webhook endpoints to trusted sources only.
  • Automate SSL certificate renewal via Certbot or Traefik ACME integration.

Typical Use Cases

  • Business process automation – integrate CRM, Slack, and Google Workspace.
  • Data pipelines – process and sync data between APIs or databases.
  • DevOps workflows – trigger CI/CD or infrastructure updates automatically.
  • Marketing automation – schedule campaigns or sync subscribers.
  • Webhook orchestration – automate real-time API-driven tasks.
  • AI and API automation – connect OpenAI, Hugging Face, or custom ML APIs.

Deploying n8n on Debian 12 with Docker Compose and Nginx provides a secure, flexible, and scalable automation environment — giving you full control over your workflows, data, and integrations while unlocking the freedom of open-source automation.


Step 1: Create a Shape.Host Instance

Go to Shape.Host and log into your account.

Click Create → Instance.

Shape.host Resources dashboard with Create > Instance highlighted.

Choose a location close to your users.

Shape.host instance form with the data center location selector highlighted.

Select a plan with at least 2 CPUs, 4 GB RAM, and 20 GB SSD.

Select Debian 12 (64-bit) as your operating system.

Shape.host instance form with the operating system image selector highlighted.

Click Create Instance.

Shape.host instance form with the Create Instance button highlighted.

After creation, copy your server IP address from the Resources section.

Shape.host Resources dashboard with the server IP address highlighted.

Step 2: Connect to the Server

Access your instance via SSH:

ssh root@your_server_ip

Step 3: Update the System

Always update your packages before installation:

apt update

This refreshes the list of available software and security updates.

Terminal showing APT package management commands and output.

Step 4: Install Docker and Dependencies

Install required dependencies for Docker:

apt install apt-transport-https ca-certificates curl software-properties-common
Terminal showing APT package management commands and output.

Add Docker’s official GPG key to verify packages:

curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

Add the Docker repository:

echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] \
https://download.docker.com/linux/debian bookworm stable" > /etc/apt/sources.list.d/docker.list

Update the package list again:

apt update
Terminal showing APT package management commands and output.

Install Docker Engine, CLI, and Compose plugin:

apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin
Terminal showing APT package management commands and output.

Check Docker versions:

docker --version
docker compose version

Step 5: Create n8n Directories

Create the folder structure for n8n:

mkdir -p ~/n8n
cd ~/n8n

Create directories for persistent storage and local file access:

mkdir n8n-data local-files

Set correct ownership (user ID 1000 is used inside the container):

chown -R 1000:1000 n8n-data local-files
Terminal showing the installed Docker Compose version.

Step 6: Create the Docker Compose File

Open a new configuration file:

nano docker-compose.yml

Paste the following configuration:

services:
  n8n:
    image: n8nio/n8n:latest
    container_name: n8n
    restart: unless-stopped
    ports:
      - "5678:5678"
    environment:
      - N8N_HOST=n8n.example.com
      - N8N_PORT=5678
      - N8N_PROTOCOL=https
      - WEBHOOK_URL=https://n8n.example.com
      - N8N_EDITOR_BASE_URL=https://n8n.example.com
      - GENERIC_TIMEZONE=UTC
      - N8N_USER_FOLDER=/home/node/.n8n
    volumes:
      - ./n8n-data:/home/node/.n8n
      - ./local-files:/files
    networks:
      - n8n-network

networks:
  n8n-network:
    driver: bridge

Replace all instances of n8n.example.com with your domain name.

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

Terminal showing the GNU nano editor and configuration text.

Step 7: Start n8n with Docker Compose

Pull and start the n8n container:

docker compose up -d
Terminal showing Docker Compose image downloads and container startup output.

List running containers:

docker compose ps
Terminal showing docker commands or output during Start n8n with Docker Compose.

Check logs to verify successful startup:

docker logs -f n8n
Terminal showing git commands or output during Start n8n with Docker Compose.

Step 8: Install Nginx as Reverse Proxy

Install Nginx:

apt install nginx
Terminal showing APT package management commands and output.

Create a new virtual host configuration:

nano /etc/nginx/sites-available/n8n.example.com

Paste the following configuration:

server {
    listen 80;
    server_name n8n.example.com;

    location / {
        proxy_pass http://localhost:5678;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Port $server_port;

        # WebSocket support
        proxy_buffering off;

        # Timeout settings for long-running workflows
        proxy_read_timeout 300s;
        proxy_connect_timeout 75s;
    }
}
Terminal showing web server configuration text.

Enable the site and test configuration:

ln -s /etc/nginx/sites-available/n8n.example.com /etc/nginx/sites-enabled/
nginx -t

Reload Nginx:

systemctl reload nginx
Terminal showing nano commands or output during Install Nginx as Reverse Proxy.

Step 9: Install SSL Certificate with Certbot

Install Certbot:

apt install certbot python3-certbot-nginx
Terminal showing APT package management commands and output.

Run Certbot to automatically configure HTTPS:

certbot --nginx -d debian-tutorials.shape.host --email contact@shape.host --agree-tos --non-interactive

Replace debian-tutorials.shape.host and the email address with your own domain and contact email.

Terminal showing Certbot certificate commands and messages.

Step 10: Verify Access

Once SSL is configured, visit:

https://n8n.example.com

or use your server’s IP and port for local testing:

http://YOUR_SERVER_IP:5678

You’ll now see the n8n Workflow Editor, ready to start automating tasks.

n8n initial owner account setup form.
n8n overview with options to create or import a workflow.

Step 11: (Optional) Enable Firewall Rules

Secure your server by allowing only essential ports:

ufw allow 80/tcp
ufw allow 443/tcp
ufw allow ssh
ufw enable

You installed n8n on Debian 12 using Docker Compose, Nginx, and SSL via Certbot.
Your automation platform is now ready for use — stable, secure, and production-ready.

For best performance and reliability, host n8n on a Shape.Host Cloud VPS, offering fast SSD storage and full root control for Docker-based applications.