n8n connects APIs and automates tasks (webhooks, CRMs, alerts). Self-hosting on a VPS avoids cloud-plan limits.
Steps
Create a data folder and start n8n:
mkdir -p ~/n8n && cd ~/n8ndocker run -d --name n8n --restart unless-stopped -p 127.0.0.1:5678:5678 -e N8N_HOST=n8n.example.com -e N8N_PORT=5678 -e N8N_PROTOCOL=https -e WEBHOOK_URL=https://n8n.example.com/ -v ~/n8n/.n8n:/home/node/.n8n docker.n8n.io/n8nio/n8nginx proxy to port 5678:
sudo tee /etc/nginx/sites-available/n8n >/dev/null <<'EOF'server { listen 80; server_name n8n.example.com; location / { proxy_pass http://127.0.0.1:5678; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $host; }}EOFsudo ln -sf /etc/nginx/sites-available/n8n /etc/nginx/sites-enabled/n8nsudo nginx -t && sudo systemctl reload nginxSSL with Certbot:
sudo certbot --nginx -d n8n.example.comOpen the UI and create the owner user:
# https://n8n.example.com
Tips
- Do not expose 5678 publicly without a proxy; the owner is created on first visit.
- Back up
~/n8n/.n8n— workflows and credentials live there.
ext step
Automate on an always-on VPS: Deploy your Cloud VPS.