n8n Self-Hosted on a Linux Server with SSL Enabled

This guide provides step-by-step instructions on how to self-host n8n, a free and open-source workflow automation tool, on a Linux server using Docker, Nginx, and Certbot for SSL with a custom domain name.

n8n Self-Hosted on a Linux Server with SSL Enabled
Shubham Kashyap, Founder, FusionSync AI
By·Founder, FusionSync AI
·

Step 1: Installing Docker

Update the package index:

sudo apt update

Install Docker:

sudo apt install docker.io

Start Docker:

sudo systemctl start docker

Enable Docker to start at boot:

sudo systemctl enable docker


Step 2: Starting n8n in Docker

Run the following command to start n8n in Docker. Replace your-domain.com with your actual domain name:

If you are using a subdomain, it should look like this:

Explanation of the command:

  • Downloads and runs the n8n Docker image.
  • Exposes n8n on port 5678.
  • Sets environment variables for the n8n host and webhook tunnel URL.
  • Mounts the n8n data directory for persistent storage.

After executing the command, n8n will be accessible at your-domain.com:5678.


Step 3: Installing Nginx

Nginx is a reverse proxy that forwards requests to n8n and handles SSL termination.

Install Nginx:

sudo apt install nginx


Step 4: Configuring Nginx

Configure Nginx to reverse proxy the n8n web interface.

Create a new Nginx configuration file:

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

Paste the following configuration:

Replace your-domain.com with your actual domain name.

Enable the configuration:

sudo ln -s /etc/nginx/sites-available/n8n.conf /etc/nginx/sites-enabled/n8n.conf

Test the Nginx configuration and restart the service:

sudo nginx -t
sudo systemctl restart nginx


Step 5: Setting up SSL with Certbot

Certbot will obtain and install an SSL certificate from Let's Encrypt.

Install Certbot and the Nginx plugin:

sudo apt install certbot python3-certbot-nginx

Obtain an SSL certificate:

sudo certbot --nginx -d n8n.envisiontech.agency

Follow the on-screen instructions to complete the SSL setup. Once completed, n8n will be securely accessible over HTTPS at your-domain.com.

n8n self hosted RAG chatbot flow view

Important Notes

  • Ensure your domain's DNS A record points to your server's IP address.
  • Allow ports 80 (HTTP), 443 (HTTPS), and 5678 (n8n) in your server's firewall.
  • Nginx handles SSL termination, so it internally forwards requests to the n8n instance over HTTP.

Why Nginx and Certbot?

  • Nginx: Acts as a reverse proxy, forwarding client requests to n8n running on Docker. This setup enhances security, load balancing, and scalability.
  • Certbot: A tool from the Electronic Frontier Foundation (EFF) that automates obtaining and renewing SSL certificates from Let's Encrypt, a free and open Certificate Authority.

By using Nginx and Certbot, you ensure that your n8n instance is securely accessible over the internet with HTTPS.


Troubleshooting

  • If you encounter issues with Nginx, check the logs located at /var/log/nginx/error.log for more details.
  • For Docker-related issues, ensure the Docker service is running:

sudo systemctl status docker

Free 7-day pilot or a free AI audit

Turn Instagram and WhatsApp inquiries into booking-ready conversations.

FusionSync is the inbound operating system for event companies. Pick the starting point that fits where you are: run a free 7-day production pilot, or start with a free audit of your Instagram, WhatsApp, and CRM flow.

Not sure which fits? Pick the audit. We can scope the pilot from there.

Option 1

Free 7-day production pilot

We install the full Instagram-to-WhatsApp inbound system on one campaign you choose. You run real traffic. You decide on day seven.

  • Capture, qualify, route, CRM-sync on one live campaign
  • 4 to 7 days setup, then 7 cost-free production days
  • Keep the same system if it works. No rebuild.
  • Stop with no obligation if it does not improve handoffs.

Option 2

Free AI audit of your sales process

No build, no commitment. We map where your current inbound and sales process is leaking, then hand you the AI fix order. Useful if you are not ready for a full pilot yet.

  • Walk-through of your Instagram, WhatsApp, and CRM flow
  • Map the leak points: missed DMs, cold handoffs, late sync
  • Written diagnosis and AI fix order, not a sales deck
  • Free, no commitment to the pilot afterward