Skip to main content
Tutorial10 min read Min Read2026-04-13

How to Self-Host n8n for Free on Oracle Cloud (With a Custom Domain)

n8n is one of the most powerful automation tools available - but the cloud-hosted version gets expensive fast, especially when you're running multiple workflows. The good news is you can self-host n8n completely free using Oracle Cloud's Always Free tier, connect it to your own domain using Cloudflare Tunnel, and have it running as a permanent service. This is exactly the setup I use to run n8n.creativehauz.space. Here's every step.

What You'll Need Before You Start

Before diving in, make sure you have the following ready: an Oracle Cloud account (free to sign up at cloud.oracle.com), a domain name with DNS managed through Cloudflare, and a Cloudflare account. You'll also need basic comfort using a terminal and SSH. Everything else in this guide is free - no credit card charges, no paid subscriptions.

Step 1: Create an Oracle Cloud Always Free VM

Log into your Oracle Cloud account and navigate to Compute → Instances → Create Instance. Select the Always Free eligible shape - Ampere A1 (ARM-based) gives you the most resources for free. Choose Ubuntu 22.04 as your operating system. Under networking, make sure a public IP address is assigned. Download your SSH key pair when prompted - you'll need this to connect to your server. Once the instance is created, note down the public IP address.

Step 2: Open the Required Firewall Ports

Oracle Cloud blocks most ports by default. You need to open port 5678 which is n8n's default port. Go to Networking → Virtual Cloud Networks → your VCN → Security Lists → Default Security List. Add an Ingress Rule: Source CIDR 0.0.0.0/0, Protocol TCP, Destination Port 5678. Also run this command on your server to allow the port through Ubuntu's firewall: sudo iptables -I INPUT -p tcp --dport 5678 -j ACCEPT. To make this persist after reboot: sudo netfilter-persistent save.

Step 3: Install Docker on Your Server

SSH into your server using: ssh -i your-key.pem ubuntu@your-public-ip. Once connected, install Docker with these commands: sudo apt update && sudo apt install -y docker.io. Then enable Docker to start on boot and start it immediately: sudo systemctl enable docker && sudo systemctl start docker. Add your user to the Docker group so you don't need sudo every time: sudo usermod -aG docker $USER. Log out and back in for this to take effect.

Step 4: Run n8n With Docker

Now run n8n as a Docker container with this command: docker run -d --restart unless-stopped --name n8n -p 5678:5678 -v n8n_data:/home/node/.n8n n8nio/n8n. Breaking this down: -d runs it in the background, --restart unless-stopped means n8n automatically restarts if the server reboots, -p 5678:5678 maps the port, and -v n8n_data:/home/node/.n8n creates a persistent volume so your workflows are saved even if the container is restarted. Verify it's running with: docker ps.

Step 5: Install Cloudflare Tunnel (cloudflared)

Rather than exposing your server IP directly, Cloudflare Tunnel creates a secure encrypted connection between your server and Cloudflare - no open inbound ports needed. Install cloudflared on your server: curl -L --output cloudflared.deb https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-arm64.deb && sudo dpkg -i cloudflared.deb. Note: use the arm64 version for Oracle's Ampere A1 instances. For x86 instances use the amd64 version instead.

Step 6: Authenticate Cloudflare Tunnel

Run this command to authenticate cloudflared with your Cloudflare account: cloudflared tunnel login. This will output a URL - copy it and open it in your browser. Select the domain you want to use for n8n. Cloudflare will create a certificate and save it to your server automatically. Once authenticated, create a named tunnel: cloudflared tunnel create n8n-tunnel. Note down the tunnel ID that gets generated - you'll need it in the next step.

Step 7: Configure the Tunnel

Create the tunnel config file: nano ~/.cloudflared/config.yml. Paste in the following, replacing YOUR_TUNNEL_ID and your domain: tunnel: YOUR_TUNNEL_ID, credentials-file: /home/ubuntu/.cloudflared/YOUR_TUNNEL_ID.json, ingress: - hostname: n8n.yourdomain.com service: http://localhost:5678 - service: http_status:404. Save and exit. Then create the DNS record that points your subdomain to the tunnel: cloudflared tunnel route dns n8n-tunnel n8n.yourdomain.com. This automatically creates a CNAME record in your Cloudflare DNS.

Step 8: Run Cloudflared as a systemd Service

To make cloudflared run permanently as a background service that survives reboots, install it as a systemd service: sudo cloudflared --config /home/ubuntu/.cloudflared/config.yml service install. Then enable and start it: sudo systemctl enable cloudflared && sudo systemctl start cloudflared. Check it's running: sudo systemctl status cloudflared. You should see active (running) in green.

Step 9: Access n8n on Your Custom Domain

Open your browser and navigate to n8n.yourdomain.com. You should see the n8n setup screen. Create your owner account with a secure email and password. Your n8n instance is now live on your custom subdomain, secured by Cloudflare's SSL, running permanently on a free Oracle Cloud server. All your workflows will persist in the Docker volume even through server restarts.

Troubleshooting Common Issues

If n8n isn't accessible after setup, check these things in order: run docker ps to confirm the n8n container is running; run sudo systemctl status cloudflared to confirm the tunnel service is active; check your Cloudflare DNS to confirm the CNAME record was created for your subdomain; and verify the config.yml hostname matches your subdomain exactly. If the tunnel keeps disconnecting, make sure your Oracle Cloud instance has sufficient memory - the free Ampere A1 with 6GB RAM handles n8n comfortably.

What to Do Next

Now that n8n is running on your own server, you can connect it to your tools - WhatsApp Cloud API, Supabase, Brevo, the Anthropic API, Groq, and more. Self-hosting means no workflow execution limits, full data privacy, and zero monthly fees. If you're building AI automation workflows for your business and want a done-for-you setup, Creative Hauz builds and manages custom n8n automation systems tailored to your business processes.

Want this set up for your business?

Creative Hauz builds done-for-you AI systems so you get the results without the setup time. Book a free 20-minute call to discuss your business.

Book a Free Discovery Call