Tutorials  /  Linux Basics

Installing and Configuring n8n on Ubuntu 24.04 Using Docker and Nginx

Ccentron Redaktion · November 2025 ·4 min read ·Linux Basics, Tutorial

n8n is an open-source automation platform that lets you interconnect different services and automate recurring actions through an intuitive, node-based visual interface. The tool supports numerous integrations and combines no-code and low-code functionality to build advanced workflow structures.

This guide walks you through the process of installing and configuring n8n on Ubuntu 24.04 via Docker, setting up Nginx as a reverse proxy, and applying TLS certificates for secure access.

Prerequisites

Before proceeding, make sure you have the following:

  • Access to a Ubuntu 24.04 server using a non-root user with sudo rights.
  • A configured DNS A record pointing to your server's public IP, such as n8n.example.com.
VM

Matching infrastructure at centron

No hardware needed to follow along: ccloud³ VMs with full root access start at €3.12 per month, billed by the hour and ready in seconds. Rent a cloud server →

Install Docker and Docker Compose

Begin by updating your system packages.

console

Console
$ sudo apt update

Install required packages needed for Docker repository management.

Console
$ sudo apt install apt-transport-https ca-certificates curl software-properties-common -y

Add Docker’s official GPG key to your system.

Console
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

Register the Docker repository with your Ubuntu installation.

Console
$ echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Refresh the package index again.

Console
$ sudo apt update

Install the Docker Engine, Docker CLI, and the Docker Compose plugin.

Console
$ sudo apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin -y

Add your user to the docker group so Docker commands can be executed without sudo.

Console
$ sudo usermod -aG docker $USER

Apply the updated group membership in your current session.

Console
$ newgrp docker

Verify that Docker is working correctly.

Console
$ docker --version

Create the n8n Directory Structure

This part explains how to set up a dedicated folder structure for n8n configuration and persistent data.

Create the base directory for n8n.

Console
$ mkdir ~/n8n

Navigate into the created directory.

Console
$ cd ~/n8n

Create a subfolder to store persistent n8n data.

Console
$ mkdir n8n-data

Create a directory for storing local files used within workflows.

Console
$ mkdir local-files

Because the n8n container operates under UID 1000, adjust file permissions accordingly.

Console
$ sudo chown -R 1000:1000 n8n-data local-files

Configure Docker Compose for n8n

Now create the Docker Compose configuration for running n8n.

Create the docker-compose.yml file.

Console
$ nano docker-compose.yml

Add the following configuration. Replace n8n.example.com with your domain.

YAML
services:
  n8n:
    image: n8nio/n8n:latest
    container_name: n8n
    restart: unless-stopped
    ports:
      - "5678:5678"
    environment:
      - N8N_HOST=n8n.example.com
      - N8N_PORT=5678
      - N8N_PROTOCOL=https
      - WEBHOOK_URL=https://n8n.example.com
      - N8N_EDITOR_BASE_URL=https://n8n.example.com
      - GENERIC_TIMEZONE=UTC
      - N8N_USER_FOLDER=/home/node/.n8n
    volumes:
      - ./n8n-data:/home/node/.n8n
      - ./local-files:/files
    networks:
      - n8n-network

networks:
  n8n-network:
    driver: bridge

Save and exit the file once done.

This setup launches an n8n container with persistent storage, webhook support, and HTTPS-related environment variables.

Install and Configure Nginx

Nginx will serve as a reverse proxy that terminates HTTPS and routes traffic to the n8n container.

Install Nginx using the package manager.

Console
$ sudo apt install nginx -y

Create a new Nginx server block. Replace the domain with your own.

Console
$ sudo nano /etc/nginx/sites-available/n8n.example.com

Add this configuration, updating the domain accordingly.

Code
server {
    listen 80;
    server_name n8n.example.com;

    location / {
        proxy_pass http://localhost:5678;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Port $server_port;

        proxy_buffering off;

        proxy_read_timeout 300s;
        proxy_connect_timeout 75s;
    }
}

This configuration supports WebSockets and defines longer timeout values, suitable for n8n workflows.

Enable the site via a symbolic link.

Console
$ sudo ln -s /etc/nginx/sites-available/n8n.example.com /etc/nginx/sites-enabled/

Check the Nginx configuration for errors.

Console
$ sudo nginx -t

Reload Nginx to activate the configuration.

Console
$ sudo systemctl reload nginx

Configure Firewall Rules

Set up firewall rules to allow required network traffic.

Permit HTTP traffic temporarily (required for certificate validation).

Console
$ sudo ufw allow 80/tcp

Enable HTTPS to support secure connections.

Console
$ sudo ufw allow 443/tcp

Install Certbot and Apply TLS Certificates

Certbot handles TLS certificate issuance and renewal via Let’s Encrypt.

Install Certbot and the Nginx plugin.

Console
$ sudo apt install certbot python3-certbot-nginx -y

Request a certificate for your domain. Replace the domain and email address as needed.

Console
$ sudo certbot --nginx -d n8n.example.com --email admin@example.com --agree-tos --non-interactive

Certbot updates your Nginx configuration to include TLS settings and ensures automated certificate renewal.

Test the renewal process.

Console
$ sudo certbot renew --dry-run

If the dry run completes without errors, auto-renewal is correctly configured.

Start n8n

This section explains how to launch n8n using Docker Compose and verify that everything is functioning.

Move to the n8n directory.

Console
$ cd ~/n8n

Start n8n in detached mode.

Console
$ docker compose up -d

Check whether the container is running correctly.

Console
$ docker compose ps

Inspect the container logs for successful initialization.

Console
$ docker logs n8n

Sample Output:

...

n8n ready on https://n8n.example.com

Access and Configure n8n

Complete the setup by creating your admin account and adjusting initial settings.

Open your browser and visit:

https://n8n.example.com

Create your administrator profile by entering your name, email, and password.

Once logged in, you can use the n8n workflow editor to build automations.

Explore predefined templates or design your own workflow agent.

Manage the n8n Container

These commands help you manage your running n8n environment.

View Logs

Monitor real-time logs.

Console
$ docker logs -f n8n

Stop n8n

Stop the container gracefully.

Console
$ docker compose down

Restart n8n

Restart the n8n container.

Console
$ docker compose restart

Update n8n

Upgrade to the newest n8n release.

Console
$ docker compose pull
$ docker compose up -d

Conclusion

You have completed the installation of n8n on Ubuntu 24.04 with Docker, configured an Nginx reverse proxy, and added TLS encryption. Your n8n instance is now prepared to build automations. The containerized setup simplifies updates, maintenance, and scaling as your automation workload expands. For additional details, consult the official n8n documentation.

Jetzt 200 € Guthaben sichern

Testen Sie Ihr Setup auf ccloud³

Registrieren Sie sich in der ccloud³ und erhalten Sie 200 € Startguthaben für Ihr Projekt – z. B. für eine PostgreSQL-VM mit automatischen Backups.

centron Redaktion Technische Redaktion

Das Redaktionsteam von centron schreibt Anleitungen aus dem Betriebsalltag: getestet auf unserer eigenen Plattform, betrieben im Rechenzentrum in Hallstadt bei Bamberg.

Kategorie Linux Basics
Teilen
Noch offene Fragen?

Our team will help you with your specific setup - in German or English, by people who run the platform themselves.

War dieses Tutorial hilfreich?

Your answer is stored anonymously and helps us improve our tutorials.

Kommentare

No comments yet - be the first to ask a question about this tutorial.

Sign in to comment

Comments are open to centron customers. Sign in to your account to ask a question about this tutorial.

Weiterlesen

Das könnte Sie auch interessieren

Jetzt kostenlos anfangen

Melden Sie sich an und erhalten Sie in den ersten 60 Tagen ein Guthaben von 200 € bei centron.

Dieses Werbeangebot gilt nur für neue Konten. Angebot ausschließlich für Gewerbetreibende.

Jetzt loslegen Sales kontaktieren