Install n8n
n8n is an open-source workflow automation tool that connects apps and services with a visual editor. Self-hosting gives you unlimited workflows, full data control, and no per-execution fees. This guide deploys n8n with Docker Compose.
Requirements
- A VPS running Ubuntu 20.04+ or Debian 11+
- Docker installed
- At least 2 GB RAM
- At least 10 GB free disk space
- A domain name pointing to your server (for SSL)
1. Connect to Your Server
ssh root@YOUR_SERVER_IP
Or use the web terminal in the Sitequest dashboard.
2. Create the Project Directory
mkdir -p /opt/n8n && cd /opt/n8n
3. Create an Environment File
nano .env
N8N_HOST=your-domain.com
N8N_PORT=5678
N8N_PROTOCOL=https
WEBHOOK_URL=https://your-domain.com/
N8N_ENCRYPTION_KEY=GENERATE_A_RANDOM_STRING
GENERIC_TIMEZONE=Europe/Berlin
Generate a random encryption key:
openssl rand -hex 32
4. Create the Docker Compose File
nano docker-compose.yml
services:
n8n:
image: n8nio/n8n:latest
restart: always
ports:
- "5678:5678"
volumes:
- n8n_data:/home/node/.n8n
env_file:
- .env
volumes:
n8n_data:
5. Start n8n
docker compose up -d
Verify it is running:
docker compose ps
6. Set Up a Reverse Proxy with SSL
If you have Nginx installed, create a server block:
nano /etc/nginx/sites-available/n8n
server {
listen 80;
server_name your-domain.com;
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;
proxy_set_header Connection "";
chunked_transfer_encoding off;
proxy_buffering off;
proxy_cache off;
}
location /rest/push {
proxy_pass http://127.0.0.1:5678;
proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 86400;
}
}
Enable and reload:
ln -s /etc/nginx/sites-available/n8n /etc/nginx/sites-enabled/
nginx -t && systemctl reload nginx
Then obtain SSL with Let's Encrypt:
certbot --nginx -d your-domain.com
7. Open Firewall Ports
If you are not using a reverse proxy, open TCP port 5678 in the Sitequest firewall. With Nginx, only ports 80 and 443 need to be open.
8. Create Your Account
Open https://your-domain.com in your browser. n8n will prompt you to create an owner account on first access.
Updating n8n
cd /opt/n8n
docker compose pull
docker compose up -d
Next Steps
- Explore the n8n workflow templates for inspiration
- Set up webhook triggers for real-time integrations
- Connect to services like Slack, GitHub, Google Sheets, and hundreds more
- Configure SMTP for email notifications in workflows
- Set up automatic backups of the
n8n_data volume