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
| Layer | Component | Role |
|---|---|---|
| OS | Debian 12 (Bookworm) | Stable and secure Linux base |
| Runtime | Docker Engine + Compose | Runs n8n and supporting services in containers |
| Database | PostgreSQL / SQLite | Stores workflow configurations, executions, and credentials |
| Application | n8n Server (Node.js) | Core automation engine and web UI |
| Reverse Proxy | Nginx | Handles HTTPS, routing, and compression |
| TLS | Let’s Encrypt / PKI | Provides 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/Capability | n8n (Self-hosted) | Zapier (Cloud) | Make (Cloud) | Node-RED (Self-hosted) |
|---|---|---|---|---|
| Hosting | Self-hosted | SaaS only | SaaS only | Self-hosted |
| Cost | Free, open-source | Subscription | Subscription | Free, open-source |
| Integrations | 400+ | 5000+ | 1500+ | 100+ |
| Extensibility | High (custom nodes) | Limited | Limited | High (custom JS) |
| Privacy | Full control | Cloud storage | Cloud storage | Local only |
| Best for | Developers / SMEs | Non-technical users | SMBs | Engineers |
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
.envor 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.

Choose a location close to your users.

Select a plan with at least 2 CPUs, 4 GB RAM, and 20 GB SSD.
Select Debian 12 (64-bit) as your operating system.

Click Create Instance.

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

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.

Step 4: Install Docker and Dependencies
Install required dependencies for Docker:
apt install apt-transport-https ca-certificates curl software-properties-common

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

Install Docker Engine, CLI, and Compose plugin:
apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin

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

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).

Step 7: Start n8n with Docker Compose
Pull and start the n8n container:
docker compose up -d

List running containers:
docker compose ps

Check logs to verify successful startup:
docker logs -f n8n

Step 8: Install Nginx as Reverse Proxy
Install Nginx:
apt install nginx

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;
}
}

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

Step 9: Install SSL Certificate with Certbot
Install Certbot:
apt install certbot python3-certbot-nginx

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.hostand the email address with your own domain and contact email.

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.


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.