Production deployment of n8n workflow automation platform
Secure n8n Deployment using Docker, NGINX & Let’s Encrypt SSL
Overview
This document provides a complete, production-ready installation and configuration guide for deploying n8n on Ubuntu 22.04, including:
Docker-based installation
Reverse proxy configuration using NGINX
HTTPS enablement using Let’s Encrypt
The guide ensures a secure, stable, and scalable deployment suitable for enterprise use.
System Requirements
Virtual Machine Specifications
Operating System
Ubuntu 22.04 LTS
–
CPU
2 vCPU
2–4 vCPU
RAM
4 GB
4–8 GB
Storage
20 GB
40–50 GB SSD
Network
Public IP Address
Static IP Preferred
Required Ports
SSH
22
n8n Web UI
5678
HTTP (NGINX)
80
HTTPS (NGINX)
443
Prerequisites
Ensure the following before starting:
A working Ubuntu 22.04 VM Public IP reachable over the internet Domain name pointing to the server
To verify domain DNS resolution:
nslookup yourdomain.comStep1: Install Docker & Docker Compose
1.1 Update System Packages
sudo apt update && sudo apt upgrade -y1.2 Install Docker Engine
sudo apt install -y apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io1.3 Install Docker Compose
sudo apt install -y docker-compose1.4 Verification
Check Docker service:
sudo systemctl status dockerCheck versions:
docker --version
docker-compose --versionStep2: Deploy n8n using Docker Compose
2.1 Create Directory
mkdir ~/n8n-compose
cd ~/n8n-compose2.2 Create Docker Compose File
sudo nano docker-compose.yml2.3 Add the Following Configuration
version: "3.3"
services:
n8n:
image: docker.n8n.io/n8nio/n8n
restart: always
ports:
- "5678:5678"
environment:
- TZ=Asia/Kolkata
- GENERIC_TIMEZONE=Asia/Kolkata
# Basic Authentication
- N8N_BASIC_AUTH_ACTIVE=true
- N8N_BASIC_AUTH_USER=admin
- N8N_BASIC_AUTH_PASSWORD=hello@123
# Database
- DB_TYPE=sqlite
# Domain
- N8N_HOST=your-domain
- N8N_PORT=5678
- N8N_PROTOCOL=http
volumes:
- n8n_data:/home/node/.n8n
volumes:
n8n_data:save the file in nano.
Press CTRL + O → then press Enter to save
Press CTRL + X to exit nano
2.4 Start n8n Service
docker compose up -d2.5 Validate Service
docker psStep3: Access n8n Web Interface
If domain is not configured:
http://<server-ip>:5678If Basic Authentication is enabled:
Username: admin
Password: hello@123
After login, set:
Email
First Name
Last Name
New admin password
This will create the primary Owner Account.
Step4: Configure NGINX Reverse Proxy
4.1 Install NGINX
sudo apt install nginx -y4.2 Create Reverse Proxy Configuration
sudo nano /etc/nginx/sites-available/n8nPaste:
server {
listen 80;
server_name yourdomain.com; #your_domain_name
location / {
proxy_pass http://127.0.0.1:5678/;
proxy_set_header Host $host;
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;
}
}save the file in nano.
Press CTRL + O → then press Enter to save
Press CTRL + X to exit nano
4.3 Enable Configuration
sudo ln -s /etc/nginx/sites-available/n8n /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginx
sudo systemctl status nginx
Step5: Enable HTTPS using Let’s Encrypt
5.1 Install Certbot
sudo apt install certbot python3-certbot-nginx -y5.2 Generate SSL Certificate
sudo certbot --nginx -d yourdomain.com

Follow prompts:
Enter email
Accept Terms of Service: Yes
Choose whether to share email
Certbot applies SSL automatically
5.3 Validate HTTPS
Open:
https://yourdomain.comExpected:
SSL padlock Secure connection n8n dashboard loads without port
Step6: Deployment Completed Successfully
n8n has been successfully installed on Ubuntu 22.04 with Docker, configured with NGINX Reverse Proxy, and secured with HTTPS using Let’s Encrypt.

Last updated