Logo
BearHost Logo

How to Connect a Custom Domain to Your n8n Instance

By Elliot, BearHost·

By default, your n8n instance is accessible via your server's IP address. You can connect a custom domain (e.g. automations.yourbusiness.com) for a professional URL with automatic HTTPS.

Prerequisites

  • A registered domain name (you can register one at bearhost.com/domains-for-sale)
  • Access to your domain's DNS settings
  • Your n8n server IP address (from your welcome email)

Step 1: Create a DNS Record

Log in to your domain registrar's DNS management panel and create an A record:

| Type | Name | Value | TTL | |------|------|-------|-----| | A | automations (or @ for root) | Your server IP | 3600 |

For example, if you want automations.example.com, set the name to automations and the value to your server IP.

Step 2: Wait for DNS Propagation

DNS changes can take 5 minutes to 48 hours to propagate globally. You can check propagation status at whatsmydns.net.

Step 3: Update Your n8n Configuration

SSH into your server (details in your welcome email):

ssh root@your-server-ip

Edit the environment file:

nano /opt/n8n/.env

Update the N8N_HOST and WEBHOOK_URL values:

N8N_HOST=automations.example.com
WEBHOOK_URL=https://automations.example.com/

Step 4: Update the Caddy Configuration

Edit the Caddyfile:

nano /opt/n8n/Caddyfile

Replace the existing server block with your domain:

automations.example.com {
    reverse_proxy n8n:5678
}

Caddy will automatically obtain and renew an SSL certificate from Let's Encrypt.

Step 5: Restart the Stack

cd /opt/n8n && docker compose down && docker compose up -d

Step 6: Verify

Visit https://automations.example.com in your browser. You should see the n8n login page with a valid HTTPS certificate (padlock icon).

Troubleshooting

  • "Connection refused": DNS hasn't propagated yet. Wait and try again.
  • "SSL error": Caddy needs to reach Let's Encrypt. Ensure ports 80 and 443 are open on your firewall.
  • Webhook URLs not working: After changing your domain, update any existing webhook trigger URLs in your workflows.

Need Help?

Contact our support team via live chat or email at support@bearhost.com. We can configure your custom domain for you at no extra cost.

Tags:#n8n#domain#ssl#caddy#custom-domain#dns