HOME BLOGS ABOUT CONTACT

let’s set up n8n on Ubuntu 24.04 for production with Docker and Nginx reverse proxy

tania andrew Suresh Thapa
| 15 Aug, 2025 | 807 views
0
0
let’s set up n8n on Ubuntu 24.04 for production with Docker and Nginx reverse proxy

What is n8n?

  • n8n stands for “node automation”.
  • It’s a low-code workflow automation tool that lets you connect apps, APIs, and databases to automate tasks.
  • Think of it as a “glue” between different software systems — it moves and transforms data automatically without you doing repetitive manual work.

 

Key Features

  1. Workflow Automation: Connect triggers (like new form submissions, emails, database changes) to actions (send email, update DB, post to social media).
  2. Low-Code / No-Code: Most actions are drag-and-drop nodes, but you can add custom code when needed.
  3. Integrations: Has hundreds of built-in integrations (Google Sheets, Slack, Twilio, Gmail, PostgreSQL, etc.) and supports custom APIs via HTTP requests.
  4. Self-Host Option: Can run on your own server for full control and privacy.
  5. Triggers & Webhooks: Start workflows automatically based on events or on a schedule.
  6. Data Transformation: Clean, filter, or modify data as it moves between apps.

 

 

let’s set up n8n on Ubuntu 24.04 for production with Docker and Nginx reverse proxy

 

step by step guide to install ubuntu server 24.04

 

Step 1 – Install Required Packages

First, update your server and install Docker + Docker Compose:

sudo apt update && sudo apt upgrade -y
sudo apt install -y docker.io docker-compose-plugin
sudo systemctl enable docker --now

 

Step 2 – Create Project Directory

We’ll keep all files organized under /opt/n8n:

sudo mkdir -p /opt/n8n
sudo chown -R 1000:1000 /opt/n8n
cd /opt/n8n

 

Add your user to the docker group

sudo usermod -aG docker $USER

Log out & back in

 

Step 3 – Create a .env File

This will store your n8n config and secrets.

nano .env

 

Example .env:

# n8n basic settings
GENERIC_TIMEZONE=Asia/Kolkata
N8N_BASIC_AUTH_ACTIVE=true
N8N_BASIC_AUTH_USER=admin
N8N_BASIC_AUTH_PASSWORD=StrongPasswordHere

# n8n URL
WEBHOOK_TUNNEL_URL=https://n8n.example.com
N8N_HOST=n8n.example.com
N8N_PORT=5678
N8N_PROTOCOL=https

# Data persistence
DATA_FOLDER=/home/node/.n8n

 

Step 4 – Create docker-compose.yml

nano docker-compose.yml

 

version: "3.8"

services:
  n8n:
    image: docker.n8n.io/n8nio/n8n
    restart: unless-stopped
    ports:
      - "5678:5678"
    environment:
      - GENERIC_TIMEZONE=${GENERIC_TIMEZONE}
      - N8N_BASIC_AUTH_ACTIVE=${N8N_BASIC_AUTH_ACTIVE}
      - N8N_BASIC_AUTH_USER=${N8N_BASIC_AUTH_USER}
      - N8N_BASIC_AUTH_PASSWORD=${N8N_BASIC_AUTH_PASSWORD}
      - WEBHOOK_TUNNEL_URL=${WEBHOOK_TUNNEL_URL}
      - N8N_HOST=${N8N_HOST}
      - N8N_PORT=${N8N_PORT}
      - N8N_PROTOCOL=${N8N_PROTOCOL}
    volumes:
      - ./n8n_data:/home/node/.n8n

 

Step 5 – Start n8n

docker compose up -d

 

Check logs:

docker compose logs -f

You should now see something like:

n8n ready on 0.0.0.0, port 5678

 

Step 6 – Install Nginx

sudo apt install nginx -y
sudo systemctl enable nginx --now

 

Step 7 – Configure Nginx Reverse Proxy

Create a new Nginx config:

sudo nano /etc/nginx/sites-available/n8n

 

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;
    }
}

 

Enable the site:

sudo ln -s /etc/nginx/sites-available/n8n /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginx

 

Step 8 – Enable SSL with Certbot

sudo apt install certbot python3-certbot-nginx -y
sudo certbot --nginx -d n8n.example.com

 

Choose option 2 when prompted to redirect HTTP → HTTPS.

 

Step 9 – Auto-Start on Boot

Docker containers already auto-restart with restart: unless-stopped,
so you’re good.

 

Step 10 – Test

  • Open https://n8n.example.com
  • Login with the username/password from .env
  • Try creating a test workflow.

 

You now have n8n running on Ubuntu 24.04 in production with Docker + Nginx + SSL.

 

Tags:

n8n

Comments

Please login to leave a comment.

No comments yet. Be the first to comment!