Ever wished your self-hosted n8n automation dashboard had a clean, professional web address like
n8n.yourdomain.com instead of a raw IP and port number?
Good news — setting up a custom domain for n8n on a VPS is easier than it sounds. It not only looks more professional, but also improves security, reliability, OAuth compatibility, and webhook handling.
In this guide, I’ll walk you through the complete, beginner-friendly process to connect a custom domain to your self-hosted n8n instance using Docker, Nginx, and free SSL.
At CreativeON, we’ve been helping businesses in Pakistan run secure VPS servers, domains, and automation tools for over 20 years — including organizations like City42, Chughtai Lab, and Orange Line Metro. This guide is based on real deployment experience, not theory.

What Is n8n and Why Use a Custom Domain?
n8n is an open-source workflow automation tool that lets you connect apps and automate tasks — such as sending emails, syncing CRMs, or triggering actions from webhooks — all on your own server.
When you self-host n8n on a VPS, using a custom domain gives you several important benefits:
- A clean and professional URL (no IP:5678)
- Free HTTPS encryption (SSL)
- Better compatibility with Google OAuth and other third-party services
- Reliable webhook URLs for production workflows
- Easier long-term scaling and maintenance
If you’re using n8n for real business workflows, a custom domain is not optional — it’s essential.
Prerequisites (Before You Start)
Make sure you have the following ready:
- A VPS server (Ubuntu 20.04 or newer recommended)
- A domain name (e.g., yourdomain.pk or .com)
- Root or sudo access to your VPS
- Docker and Docker Compose installed
- n8n already running in Docker
💡 CreativeON provides VPS hosting in Pakistan optimized for automation tools like n8n, with local latency advantages and easy upgrade paths.
Choosing the Right VPS for n8n
n8n is lightweight, but real-world automations grow fast.
Minimum VPS Requirements
- 1 CPU core
- 2 GB RAM
- 20 GB SSD storage
Recommended for Business Use
- 2+ CPU cores
- 4 GB RAM or more
- SSD storage with backups enabled
If you’re handling frequent webhooks, background jobs, or multiple users, investing in a slightly higher VPS plan avoids performance bottlenecks later.
Step 1: Point Your Domain to the VPS
First, connect your domain to your server.
- Log in to your domain’s DNS manager
- Create an A record:
- Host: n8n
- Type: A
- Value: Your VPS public IP
- Host: n8n
- Save changes
DNS usually propagates within 5–60 minutes.
👉 You can verify propagation using tools like DNS Checker.
Step 2: Update n8n Configuration (Docker Setup)
If you’re running n8n with Docker Compose, you’ll need to update its environment variables.
Stop n8n
docker compose down
Â
Edit Docker Compose File
nano docker-compose.yml
Â
Update or add the following environment variables:
environment:
  – N8N_HOST=n8n.yourdomain.com
  – N8N_PORT=5678
  – N8N_PROTOCOL=https
  – WEBHOOK_URL=https://n8n.yourdomain.com/
Â
Save the file and restart n8n:
docker compose up -d
Â
At this point, n8n knows it should operate behind HTTPS and your custom domain.
Step 3: Set Up Nginx Reverse Proxy
Nginx will:
- Handle HTTPS
- Forward traffic to n8n
- Support WebSockets (required for n8n UI)
Install Nginx
apt update
apt install nginx -y
Â
Create Nginx Config
nano /etc/nginx/sites-available/n8n
Â
Paste this configuration (replace domain if needed):
server {
    listen 80;
    server_name n8n.yourdomain.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 config:
ln -s /etc/nginx/sites-available/n8n /etc/nginx/sites-enabled/
nginx -t
systemctl reload nginx
Â
Step 4: Secure n8n with Free SSL (HTTPS)
Use Certbot to add free SSL from Let’s Encrypt.
apt install certbot python3-certbot-nginx -y
certbot –nginx
Â
Follow the prompts and select your domain.
Once complete, reload Nginx:
systemctl reload nginx
Â
Your n8n dashboard is now securely available at:
https://n8n.yourdomain.com
Â
Firewall & Security Tips (Highly Recommended)
- Open only ports 80 and 443
- Do NOT expose port 5678 publicly
- Keep Docker and system packages updated
- Enable automated VPS backups
These small steps significantly reduce security risks.
Common Questions (Quick Help)
How long does DNS take?
Usually minutes, but allow up to one hour.
n8n isn’t loading after setup?
Check logs:
docker logs n8n
Â
Also confirm Nginx is running and SSL is valid.
Can I scale later?
Yes. You can upgrade CPU/RAM on your VPS without reinstalling n8n.
Final Thoughts
Setting up a custom domain for n8n on a VPS is one of the best upgrades you can make for a production automation setup. It improves security, reliability, integrations, and long-term scalability.
If you’re running n8n for business workflows in Pakistan, hosting it on a local, optimized VPS gives you better performance and support when it matters.
Need help choosing the right VPS or setting this up professionally?
CreativeON is always here to help.