How to Host n8n on Server Free: Step-by-Step Guide 2026
Learn how to host n8n on server free with this complete step-by-step guide. Deploy n8n workflow automation on free cloud platforms like Oracle Cloud, Railway, and Render without spending a dime. This tutorial covers Docker setup, database configuration, SSL certificates, and production deployment best practices.
🎯 Why Self-Host n8n? Save $20-200/month on cloud subscriptions. Get unlimited workflow executions, complete data privacy, and full control over your automation infrastructure. Perfect for businesses and developers who want enterprise-grade automation without enterprise costs.
Why Host n8n for Free?
Self-hosting n8n gives you complete control over your automation workflows while eliminating monthly subscription costs. Here's what you get:
| Feature | n8n Cloud | Self-Hosted (Free) |
|---|---|---|
| Monthly Cost | $20-$200+ | $0 (free tier) |
| Workflow Executions | Limited by plan | Unlimited |
| Data Privacy | Cloud storage | Your server |
| Custom Integrations | Limited | Full access |
| Uptime Control | 99.9% | 100% control |
Prerequisites
- Basic understanding of command line/terminal
- Git installed on your computer
- Docker Desktop installed (for local testing)
- Free cloud account (Oracle Cloud, Railway, or Render)
- Domain name (optional, for custom URL)
Method 1: Oracle Cloud Free Tier (Recommended)
Step 1: Create Oracle Cloud Account
- Sign up at cloud.oracle.com
- Choose "Always Free" resources
- Verify your account (credit card required for verification, but no charges)
- Create an OCI compartment for organization
Step 2: Launch VM Instance
- Navigate to Compute → Instances
- Click "Create Instance"
- Choose Ubuntu 22.04 image
- Select VM.Standard.E2.1.Micro (Always Free)
- Add SSH key (generate new or use existing)
- Click "Create"
Step 3: Install Docker
Connect to your VM via SSH and run:
Docker Installation Commands Terminal
ssh -i ~/.ssh/your-key ubuntu@your-vm-ip
sudo apt update && sudo apt upgrade -y
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -aG docker $USER
newgrp docker
Step 4: Deploy n8n with Docker
Create a docker-compose.yml file:
Docker Compose Configuration Production
version: '3.8'
services:
n8n:
image: n8nio/n8n:latest
container_name: n8n
restart: always
ports:
- "5678:5678"
environment:
- N8N_BASIC_AUTH_ACTIVE=true
- N8N_BASIC_AUTH_USER=admin
- N8N_BASIC_AUTH_PASSWORD=your-secure-password
- WEBHOOK_URL=https://your-domain.com
volumes:
- n8n_data:/home/node/.n8n
volumes:
n8n_data:
Step 5: Start n8n
Run the deployment:
docker-compose up -d
docker-compose logs -f
Method 2: Railway (Simplest)
Step 1: Create Railway Account
- Go to railway.app
- Sign up with GitHub
- Get $5 free credit (no credit card required)
Step 2: Deploy n8n Template
- Click "New Project"
- Select "Deploy from GitHub repo"
- Use n8n's official template
- Add PostgreSQL database
- Configure environment variables
Railway Environment Variables Config
GENERIC_TIMEZONE=UTC
N8N_BASIC_AUTH_ACTIVE=true
N8N_BASIC_AUTH_USER=admin
N8N_BASIC_AUTH_PASSWORD=your-password
DB_TYPE=postgresdb
DB_POSTGRESDB_HOST=${{postgres.POSTGRES_HOST}}
DB_POSTGRESDB_PORT=5432
DB_POSTGRESDB_USER=${{postgres.POSTGRES_USER}}
DB_POSTGRESDB_PASSWORD=${{postgres.POSTGRES_PASSWORD}}
DB_POSTGRESDB_DATABASE=${{postgres.POSTGRES_DB}}
Method 3: Render (Alternative)
Step 1: Create Render Account
- Visit render.com
- Sign up with GitHub
- Free tier includes 750 hours/month
Step 2: Create Web Service
- Click "New" → "Web Service"
- Connect your GitHub repository
- Choose Docker as environment
- Set instance type to "Free"
- Add PostgreSQL database
Security Configuration
Enable HTTPS with Let's Encrypt
For production deployments, always use HTTPS:
Certbot Installation Security
sudo apt install certbot python3-certbot-nginx -y
sudo certbot --nginx -d your-domain.com
sudo certbot renew --dry-run
Firewall Configuration
Secure your server with firewall rules:
- Oracle Cloud: Configure Security Lists to allow only ports 22, 80, 443
- Ubuntu UFW:
sudo ufw allow 22 && sudo ufw allow 5678 && sudo ufw enable
Database Setup
For production, use PostgreSQL instead of SQLite:
| Database | Best For | Setup Complexity |
|---|---|---|
| SQLite | Testing/Development | Easy (built-in) |
| PostgreSQL | Production | Medium |
| MySQL | Production | Medium |
Backup Strategy
Automated Backups:
✅ Set up cron jobs for daily database dumps
✅ Backup n8n_data volume regularly
✅ Store backups in cloud storage (S3, Google Drive)
✅ Test restore procedures monthly
Performance Optimization
Resource Allocation
- Minimum: 1GB RAM, 1 vCPU
- Recommended: 2GB RAM, 2 vCPU
- High Volume: 4GB+ RAM, 4+ vCPU
Environment Variables for Performance
EXECUTIONS_DATA_PRUNE=true
EXECUTIONS_DATA_MAX_AGE=168
EXECUTIONS_DATA_SAVE_ON_ERROR=all
EXECUTIONS_DATA_SAVE_ON_SUCCESS=none
WEBHOOK_TIMEOUT=30000
Troubleshooting Common Issues
Issue: Container Won't Start
Solution: Check Docker logs with docker-compose logs n8n and verify port 5678 isn't in use.
Issue: Webhooks Not Working
Solution: Ensure WEBHOOK_URL environment variable is set correctly and firewall allows inbound traffic.
Issue: Database Connection Errors
Solution: Verify database credentials and ensure PostgreSQL is running: docker-compose ps
Monitoring & Maintenance
- Update n8n:
docker-compose pull && docker-compose up -d - Check logs:
docker-compose logs -f - Monitor resources: Use
htopordocker stats - SSL renewal: Certbot auto-renews, verify with
certbot certificates
Cost Breakdown
| Platform | Monthly Cost | Resources | Best For |
|---|---|---|---|
| Oracle Cloud | $0 (Always Free) | 1GB RAM, 1 vCPU | Long-term projects |
| Railway | $0 (with $5 credit) | 512MB RAM | Quick deployment |
| Render | $0 (750 hrs/month) | 512MB RAM | Testing/Development |
| VPS (DigitalOcean) | $5-10/month | 1-2GB RAM | Production |
Conclusion
Hosting n8n on server free is entirely possible with these methods. Oracle Cloud offers the best long-term solution with always-free resources, while Railway and Render provide quick deployment options. Follow the security best practices, set up regular backups, and you'll have enterprise-grade workflow automation running 24/7 at zero cost.
Ready to build automations? Check out our guides on n8n workflow examples for beginners and free n8n automation ideas to start automating your business.