1. Purpose
This guide explains how to deploy n8n on a ReadySpace Cloud Server using Docker, including secure HTTPS setup with SSL and recommended system hardening.
2. Who Should Use This Guide
- Familiar with basic Linux command-line operations
- Knowledgeable about Docker & Docker Compose
- Able to configure DNS and reverse proxy using Nginx
- Understands SSL certificate issuance via Let’s Encrypt / Certbot
3. Prerequisites
3.1 Server Requirements
- Ubuntu 20.04 or newer on ReadySpace Cloud Server
- Root or sudo privileges
- Domain or subdomain pointing to your server (e.g.,
n8n.example.com
)
3.2 Install Required Packages
sudo apt update && sudo apt upgrade -y
sudo apt install -y docker.io docker-compose nginx certbot python3-certbot-nginx
sudo systemctl enable docker
Verify installation:
docker -v
docker compose version
nginx -v
certbot --version
4. Step‑by‑Step Implementation
4.1 Prepare Working Directory
mkdir -p /opt/n8n && cd /opt/n8n
4.2 Create .env
File
# .env
N8N_BASIC_AUTH_ACTIVE=true
N8N_BASIC_AUTH_USER=yourusername
N8N_BASIC_AUTH_PASSWORD=yourstrongpassword
N8N_HOST=n8n.example.com
N8N_PORT=5678
N8N_PROTOCOL=https
WEBHOOK_TUNNEL_URL=https://n8n.example.com
4.3 Create docker-compose.yml
version: "3.7"
services:
n8n:
image: n8nio/n8n
restart: always
environment:
- DB_SQLITE_FILE=/home/node/.n8n/database.sqlite
- N8N_BASIC_AUTH_ACTIVE=${N8N_BASIC_AUTH_ACTIVE}
- N8N_BASIC_AUTH_USER=${N8N_BASIC_AUTH_USER}
- N8N_BASIC_AUTH_PASSWORD=${N8N_BASIC_AUTH_PASSWORD}
- N8N_HOST=${N8N_HOST}
- N8N_PORT=${N8N_PORT}
- N8N_PROTOCOL=${N8N_PROTOCOL}
- WEBHOOK_TUNNEL_URL=${WEBHOOK_TUNNEL_URL}
ports:
- "5678:5678"
volumes:
- ./n8n_data:/home/node/.n8n
4.4 Configure Nginx Reverse Proxy
sudo nano /etc/nginx/sites-available/n8n
# Paste the following content:
server {
listen 80;
server_name n8n.example.com;
location / {
proxy_pass http://localhost: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;
}
}
sudo ln -s /etc/nginx/sites-available/n8n /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx
4.5 Issue SSL with Certbot
sudo certbot --nginx -d n8n.example.com
sudo crontab -e
# Add this line:
0 3 * * * /usr/bin/certbot renew --quiet
4.6 Start n8n
docker compose up -d
5. Post‑Deployment Checklist
Task | Command / Action |
---|---|
Access n8n | https://n8n.example.com |
Login | Use credentials in the .env file |
Test workflow | Create a webhook and trigger using Postman or browser |
Restart n8n | docker compose restart |
View logs | docker compose logs -f |
6. Maintenance & Upgrades
docker compose pull
docker compose down
docker compose up -d
7. Security Hardening
- Enable UFW firewall:
sudo ufw allow 22,80,443/tcp
sudo ufw enable
- Install and configure
fail2ban
- Use SSH key-based login; disable password authentication
- Backup the
./n8n_data
directory regularly