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.

Step 1: Installing Docker
Update the package index:
Install Docker:
Start Docker:
Enable Docker to start at boot:
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:
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:
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:
Obtain an SSL certificate:
Follow the on-screen instructions to complete the SSL setup. Once completed, n8n will be securely accessible over HTTPS at your-domain.com.

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:
Next step
Let's Fix Your Lead Response in 30 Minutes
We'll walk through your current lead flow, identify where leads are slowing down or getting missed, and show you exactly what can be automated to increase speed, conversations, and bookings.
Where it works
View all use cases