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:
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:
Update repositories and install Docker + Compose:
Check versions:
📌 Output example:
This confirms Docker is installed and ready.
Prepare the Project Directory
Create a dedicated directory for n8n:
Generate an Encryption Key
This key is used to encrypt credentials inside n8n:
Create the docker-compose.yml
Open the file:
Paste the configuration (replace YOUR_SERVER_IP with your AlexHost VPS IP):
Start n8n
Run the container in detached mode:

Output example will be like:
Check running containers:
Output will be like following:
Verify Logs
Make sure there are no errors:
📌 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:
curl http://176.123.2.191:5678
