How to Install n8n on Your Own Server with Docker
automationtutorialn8nnocodedockervpsdomainserver

How to Install n8n on Your Own Server with Docker

Have you ever wanted to connect different apps and automate tasks, but found tools like Zapier or Make a bit restrictive or expensive? Let me introduce you to n8n, a powerful, open-source, and self-hostable workflow automation tool.

Self-hosting gives you full control over your data, your workflows, and your costs. In this guide, we'll walk you through the entire process of setting up n8n on your own server, from scratch. It's easier than you think!

Here's what we'll cover:

  1. Buying a domain name.
  2. Setting up a Virtual Private Server (VPS).
  3. Pointing your domain to your server.
  4. Installing n8n using the magic of Docker.

Let's get started!

Step 1: Get a Domain Name

First things first, you'll want a nice address for your n8n instance, like n8n.mycoolproject.com. A domain name is your unique address on the internet.

You can buy one from a domain registrar. There are many out there, but some popular choices are:

The process is simple: search for a name you like, add it to your cart, and complete the purchase. It usually costs around $10-15 per year.

Step 2: Set Up Your Server (VPS)

A Virtual Private Server (VPS) is like your own small, private computer in the cloud. It's where we'll install n8n. Don't worry, you don't need a super-powerful machine. A basic server will do just fine.

Some great VPS providers are:

When you sign up, choose a basic plan. Something with 1 CPU and 2GB of RAM is a great starting point. For the operating system, select Ubuntu 22.04.

Once your server is created, the provider will give you an IP address (e.g., 123.45.67.89). Keep this handy; it's the direct address of your new server.

Step 3: Point Your Domain to the Server

Now, let's connect your domain to your server. Go back to your domain registrar's website and find the DNS Management or DNS Settings section for your domain.

You need to create an 'A' record. Here’s what the settings will look like:

  • Type: A
  • Host/Name: You can use @ if you want to use the main domain (e.g., yourdomain.com), but it's better to use a subdomain. Let's use n8n. So you'd type n8n here.
  • Value/Points to: Your server's IP address (e.g., 123.45.67.89).
  • TTL (Time To Live): You can usually leave this at the default setting (like "Automatic" or "1 hour").

Click "Save" or "Add Record". DNS changes can sometimes take a little while to spread across the internet (this is called propagation), so be patient. It can take anywhere from a few minutes to a few hours.

Step 4: Install Docker on Your Server

Docker is a tool that lets us run applications in isolated containers. It makes installing complex software like n8n incredibly simple. n8n provides an official Docker "image" that has everything ready to go.

First, connect to your server using SSH. Open a terminal on your computer and type:

ssh root@your_server_ip

(Replace your_server_ip with your server's actual IP address).

Once you're connected, run these commands to install Docker:

# Update your server's package list
sudo apt update

# Install Docker
sudo apt install docker.io -y

# Start and enable Docker to run on boot
sudo systemctl start docker
sudo systemctl enable docker

That's it! Docker is now installed and running.

Step 5: Run n8n with Docker

This is the exciting part! We'll use a single command to download and run n8n.

First, let's create a directory on your server to store n8n's data. This is important so your workflows and credentials are not lost if you update or restart the container.

mkdir ~/n8n-data

Now, run the n8n container:

docker run -d --restart unless-stopped \
  --name n8n \
  -p 5678:5678 \
  -v ~/n8n-data:/home/node/.n8n \
  n8nio/n8n

Let's quickly break down this command:

  • docker run: The command to run a container.
  • -d: Runs the container in "detached" mode (in the background).
  • --restart unless-stopped: Automatically restarts n8n if the server reboots.
  • --name n8n: Gives the container a friendly name.
  • -p 5678:5678: Maps port 5678 on your server to port 5678 inside the n8n container.
  • -v ~/n8n-data:/home/node/.n8n: This is the magic part. It links the n8n-data folder we created on our server to the folder where n8n stores its data inside the container. This ensures your data is safe!
  • n8nio/n8n: The official n8n Docker image.

Step 6: Access Your n8n Instance!

You're all set! Open your web browser and navigate to:

http://your_server_ip:5678

You should be greeted by the n8n setup screen. Congratulations, you've successfully installed n8n!

Bonus: Using Your Domain with HTTPS

Accessing n8n via an IP address works, but it's not professional or secure. You'll want to use your domain (n8n.yourdomain.com) and secure it with HTTPS.

The easiest way to do this is with a reverse proxy called Caddy. Caddy automatically handles SSL certificates for you (free HTTPS!).

  1. Install Caddy on your server:

    sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https
    curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
    curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
    sudo apt update
    sudo apt install caddy
    
  2. Configure Caddy: Create a configuration file for Caddy called Caddyfile:

    sudo nano /etc/caddy/Caddyfile
    

    Delete everything in that file and add the following lines. Make sure to replace n8n.yourdomain.com with your actual domain!

    n8n.yourdomain.com {
        reverse_proxy localhost:5678
    }
    

    Save the file (press Ctrl+X, then Y, then Enter).

  3. Reload Caddy:

    sudo systemctl reload caddy
    

That's it! Now you can access your n8n instance securely at https://n8n.yourdomain.com. Caddy will keep your SSL certificate renewed automatically.

Conclusion

You did it! You have a powerful, private automation platform up and running. Now you can start connecting your favorite apps and building amazing workflows.

Happy automating!

Need help with automation?

Our team of experts can help you implement the solutions described in this article.

Contact us
Copyright © 2026. Fet amb ♥ per Ruben Baraut