• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

BeginnersBox

How to Guides, Tutorials and Much More

  • Home
  • Tutorials
  • Opinions
You are here: Home / Tutorials / How to Install and Configure n8n on Ubuntu?

How to Install and Configure n8n on Ubuntu?

By Sourabh Verma | November 9, 2025 | Updated on: November 28, 2025

Facebook Share on Facebook Twitter Share on Twitter LinkedIn Share on LinkedIn Reddit Share on Reddit WhatsApp Share on WhatsApp Email Share via Email

If you are looking for an automation tool, then n8n is for you. N8N, which is also known as “node everywhere node,” is an open-source tool that will help you in developing your own automation work. The best part of this tool is that you don’t even have to code; n8n offers you a graphical interface that you can use to automate your processes.

Here in this tutorial, I will tell you how to install and configure n8n on Ubuntu for both testing and production servers with Let’s Encrypt SSL.

In this tutorial, you will learn

  • Features of n8n
  • Prerequisite
  • Step 1 – Installing Docker on Ubuntu
  • Step 2 – Create an Environment for Docker
  • Step 3 – Start n8n and test the Installation
  • Step 4 – Set up Nginx webserver for n8n
    • Option 1 – Testing server
    • Option 2 – Production Server
  • Step 5 – Configure Let's Encrypt SSL on n8n
  • Step 6 – Updating Firewall
  • Conclusion

Features of n8n

Gui-Based Editor – A Very simple drag and drop designer, using which you can configure a simple to highly complex automation system. You can easily edit nodes, add or remove any logic.

Lots of integrations – A Huge list of tools that you can connect to each other and make an awesome automation tool. Tools like GitHub, Slack, Google Sheets, MySQL, AWS, Trello, and many more.

Self-Hosting Support – You can host n8n on your own setup using Docker, which gives you full control over your setup.

Native JavaScript – All the JavaScript needed is available on your setup. You can even write your own JavaScript and add it anywhere you want, which gives you the freedom to inject your own functionality.

Robust Security – You can set up authentication, SSL, and also manage a granular level of permissions to safeguard the data, and this makes n8n highly suitable for a production-based environment.

Prerequisite

  • A registered domain
  • An Ubuntu VPS or bare-metal server
  • User with root privileges
  • Email ID for Let’s Encrypt SSL

Step 1 – Installing Docker on Ubuntu

The first step is to install Docker on Ubuntu, which will handle all our n8n-related processes.

# sudo apt update
# sudo apt install -y docker.io docker-compose

Step 2 – Create an Environment for Docker

The second step is to set up the Docker environment and directory.

sudo mkdir ~/n8n
cd ~/n8n

Let’s create a file that will have our setup’s configuration

sudo nano docker-compose.yml
version: '3.7'

services:
  db:
    image: postgres:14
    environment:
      - POSTGRES_USER=n8n
      - POSTGRES_PASSWORD=n8npass
      - POSTGRES_DB=n8n
    volumes:
      - postgres_data:/var/lib/postgresql/data

  n8n:
    image: n8nio/n8n
    ports:
      - "5678:5678"
    environment:
      - DB_TYPE=postgresdb
      - DB_POSTGRESDB_HOST=db
      - DB_POSTGRESDB_DATABASE=n8n
      - DB_POSTGRESDB_USER=n8n
      - DB_POSTGRESDB_PASSWORD=n8npass
      - N8N_BASIC_AUTH_ACTIVE=true
      - N8N_BASIC_AUTH_USER=admin
      - N8N_BASIC_AUTH_PASSWORD=strongpass
      - N8N_HOST=n8n.yourdomain.com
      - WEBHOOK_TUNNEL_URL=https://n8n.yourdomain.com
    depends_on:
      - db
    volumes:
      - n8n_data:/home/node/.n8n

volumes:
  postgres_data:
  n8n_data:

Note: Make sure to enter a strong password for “N8N_BASIC_AUTH_PASSWORD” and “DB_POSTGRESDB_PASSWORD“

Step 3 – Start n8n and test the Installation

The third step is to start the n8n service and test the installation.

# sudo docker-compose up -d

Now, open any browser and enter http://your-ip-address:5678

Step 4 – Set up Nginx webserver for n8n

The fourth step is to set up the Nginx web server, which will handle n8n processes. So let’s install Nginx and certbot

# sudo apt install -y nginx certbot python3-certbot-nginx

Now we will have to create our web server configuration file. You can choose among the files given below

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

Now, copy and paste the file given below as per your need

Option 1 – Testing server

If you are setting up n8n for testing purposes, use the below configuration

server {
  listen 80;
  server_name yourdomain.com;

  location / {
    proxy_pass http://localhost:8088;
    proxy_set_header Host $host;
    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;
  }
}

Option 2 – Production Server

If you are setting up n8n for production use the below configuration

server {
    listen 80;
    server_name n8n.yourdomain.com;
    return 301 https://$server_name$request_uri;
}

server {
    listen 443 ssl;
    server_name n8n.yourdomain.com;

    ssl_certificate /etc/letsencrypt/live/n8n.yourdomain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/n8n.yourdomain.com/privkey.pem;

    location / {
        proxy_pass http://localhost:5678;  # Corrected port
        proxy_set_header Host $host;
        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;
    }
}

Link the file in the sites-enabled directory

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

If everything is good, restart the nginx service

# sudo systemctl restart nginx

Step 5 – Configure Let’s Encrypt SSL on n8n

The fifth step is to configure Let’s Encrypt SSL.

sudo certbot –nginx -d n8n.yourdomain.com

Step 6 – Updating Firewall

Finally, make sure to update ufw firewall as per the configurations we have done above

# sudo ufw allow 80,443,5678

Conclusion

With this, you have successfully configured n8n on Ubuntu. Now, just open the domain on any browser and continue the setup.

Category: Tutorials Tagged In: linux, Server, Ubuntu

Facebook Share on Facebook Twitter Share on Twitter LinkedIn Share on LinkedIn Reddit Share on Reddit WhatsApp Share on WhatsApp Email Share via Email

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

About Sourabh

Hi, I am Sourabh. With over 12 years of experience in Linux, Windows, servers, databases and other I.T related areas, I make sure to publish easy and well tested tutorials and opinions. I hope you like my work. Thanks

Stay with BeginnersBox

FacebookFollow on FacebookTwitterFollow on TwitterLinkedInFollow on LinkedInYouTubeSubscribe on YouTubeInstagramFollow on InstagramRSSSubscribe to RSS Feed

Copyright © 2026 · BeginnersBox · All Rights Reserved.

  • Contact Us
  • Privacy Policy
  • Disclaimer