Run n8n with CloudPanel Hosting (Step-by-Step Guide)

Creating AI agents with n8n has become increasingly popular, and if you’re planning to self-host your own n8n instance using CloudPanel, this step-by-step guide will walk you through the entire process.

In this guide, we’ll show you how to set up n8n, a powerful open-source automation tool, on a server using CloudPanel. We’ll walk you through installing Docker on Ubuntu, running n8n in a container, setting up a reverse proxy with CloudPanel, and securing everything so you can access your n8n dashboard safely.

By the end, you’ll have your own n8n server up and running — perfect for creating AI agents or for tasks like sending emails, connecting to APIs, or even running your own custom scripts and AI workflows.

Run n8n with CloudPanel Hosting

What Are n8n and CloudPanel?

n8n (pronounced “n-eight-n”) is an open-source workflow automation tool that allows you to visually design and execute workflows by connecting APIs, databases, AI models, and custom scripts. It’s especially powerful when building autonomous agents, thanks to its support for loops, conditionals, API calls, and external integrations like OpenAI, Hugging Face, and more.

CloudPanel is a modern hosting control panel optimized for PHP and Node.js applications. It makes it easy to manage websites, SSL certificates, databases, and users via a clean web UI.

Although CloudPanel doesn’t natively support Docker apps like n8n, it runs on Ubuntu — so we can manually install Docker and run n8n alongside it and access n8n dashboard via reverse proxy.

Steps to Run n8n with CloudPanel

Step 1: SSH Into Your CloudPanel Server

First, connect to your CloudPanel server via SSH:

ssh ubuntu@server-ip
or
ssh -i <private-key> ubuntu@server-ip

Step 2: Install Docker on Ubuntu

If docker is already not installed, install Docker and Docker Compose first. We have already created a tutorial on How to install docker on Ubuntu, you can follow that or directly use the below commands.

# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

# Add the repository to Apt sources:
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
  $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update

sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

Verify Docker is working:

docker --version
Docker version 28.2.1, build 879ac3f

Step 3: Create a Docker Volume for n8n

It is important to persist data when docker container is recreated, so we will create a docker voume for n8n.

sudo docker volume create n8n_data

Step 4: Run n8n with Docker

Create a docker compose configuration file with the below details and replace the WEBHOOK_URL and N8N_EDITOR_BASE_URL with acutal domain name that you will use for n8n.

## Docker compose for N8N
##version: '3.8'

services:
  n8n:
    image: docker.n8n.io/n8nio/n8n
    container_name: n8n
    ports:
      - "5678:5678"
    environment:
      - WEBHOOK_URL=https://<n8n.domain.com>/
      - N8N_HOST=n8n.wpcheck.sbs
      - N8N_PORT=5678
      - N8N_PROTOCOL=https
      - N8N_EDITOR_BASE_URL=https://<n8n.domain.com>
      - N8N_ENDPOINT_WEBHOOK=webhook
      - N8N_ENDPOINT_WEBHOOK_TEST=webhook-test
      - NODE_ENV=production
      - EXPRESS_TRUST_PROXY=true
    volumes:
      - n8n_data:/home/node/.n8n
    restart: unless-stopped

volumes:
  n8n_data:

Start the container:

sudo docker compose -f docker-compose-n8n.yml up -d

This will create your docker container. You can check running docker containers by running sudo docker ps command

Step 5: Create Reverse Proxy in CloudPanel and Configure Domain

  1. Go to your CloudPanel dashboard.
  2. Add a new site (e.g., n8n.domain.com or n8n-domain.com) and select “create a Reverse Proxy
  3. In Reverse Proxy url, put http://127.0.0.1:5678
  4. Enable Let’s Encrypt SSL for the domain if you are not using Cloudflare SSL
cloudpanel reverse proxy setting for n8n

No other vhost configuration is required if you are directly using Reverse Proxy site in CloudPanel.

Step 6: Update DNS Record

Go to your domain name provider and point your n8n domain to server IP. You can use A record to point n8n domain to your server’s IP.

Step 7: Access n8n in the Browser

Now visit your n8n domain. If everthing is set properly, you will be able to access your self-hosted n8n instance.

You will get the setup screen to register the user. The first user who is registred is Admin.

From here, you can start building your workflows!

🛠 Troubleshooting Common Issues

If something goes wrong, don’t worry. Below are some common issues and how to fix them:

1. n8n Not Loading on Browser

  • Symptoms: You go to https://n8n.yourdomain.com and it times out or shows a blank page.

Fixes:

  • Make sure the Docker container is running: docker ps You should see n8n in the list. If not, run: docker compose up -d
  • Check if port 5678 is open and the container is listening: netstat -tuln | grep 5678
  • Check the logs for errors: docker logs n8n

2. SSL Not Working or Shows Invalid Certificate

  • Symptoms: Browser says the site is not secure, or shows a self-signed certificate.

Fixes:

  • In CloudPanel, go to the site’s settings and ensure Let’s Encrypt is enabled.
  • Make sure DNS is correctly pointing to your server’s IP.

3. 502 Bad Gateway (CloudPanel NGINX Error)

  • Symptoms: Browser shows a 502 error from NGINX when trying to access n8n.

Fixes:

  • Confirm that the container is running and listening on port 5678.
  • Double-check that the proxy config in NGINX points to http://127.0.0.1:5678;
  • Reload NGINX: systemctl reload nginx

4. Authentication Not Working in n8n

  • Symptoms: You set N8N_BASIC_AUTH_ACTIVE=true but can access n8n without a login.

Fixes:

  • Double-check your .env file formatting — no spaces around =.
  • Rebuild the container after making changes: docker compose down docker compose up -d

5. Docker Compose Command Not Found

  • Symptoms: Running docker compose gives an error.

Fixes:

  • Use the full command (with hyphen): docker-compose up -d If both versions are unavailable, install Docker Compose: sudo apt-get install docker-compose-plugin -y

6. n8n Data Not Persisting After Restart

  • Symptoms: Workflows disappear after restarting the container.

Fixes:

  • Ensure you’re using a persistent volume (n8n_data) in your docker-compose.yml.
  • Check if the volume is properly mounted: docker volume inspect n8n_data

✅ Quick Checklist Before Going Live

  • DNS is pointed to your server IP.
  • SSL is working with Let’s Encrypt.
  • Docker container is up and accessible.
  • Reverse Proxy url is set to http://127.0.0.1:5678

With these steps, you’ve successfully set up a production-ready instance of n8n using Docker on a CloudPanel-managed server. Enjoy automating!

Buy me a coffeeBuy me a coffee

Add Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.