Guide to Connecting a Domain and Enabling SSL for N8N VPS
When deploying N8N on a VPS, attaching a custom domain makes access easier than using an IP address. Additionally, enabling SSL (HTTPS) secures the connection, boosts...
When deploying N8N on a VPS, attaching a custom domain makes access easier than using an IP address. Additionally, enabling SSL (HTTPS) secures the connection, boosts reliability, and prevents 'Not Secure' warnings.
This article by the companyVPTSwill provide detailed instructions on attaching a domain and activating SSL for your N8N VPS.
1. Preparation Before Starting
Before starting, you need:
- VPS with N8N installed (according to VPTS's instructions).
- Domain you own, can be purchased from providers such as Namecheap, Cloudflare
- SSH access to VPS
2. Assign Domain to N8N VPS
Step 1: Point domain via Cloudflare
- Visit https://dash.cloudflare.com
- Select the domain you want to link with N8N.
Step 2: Open DNS management
- You see your domain, click Configure DNS
- Click Add record, select Type A, enter your domain name in Name, and enter your previously purchased IP in IP
- Note: In proxy status, toggle it off, then save
Step 3: Check pointed Domain
- After saving, wait about 2–10 minutes for DNS to update. Open Terminal (CMD) and run the following command to check:
ping [Tên miền]
- If the response returns the correct IP matching your VPS ⇒ The domain has been pointed successfully.
2. Configure N8N to Use Domain
Step 1: Log in via SSH
- Log in to n8n VPS and enableNew terminal console
- First, run the following command to stop all n8n container operations
docker compose down
Step 2: Create configuration file
- Run the 3 commands below to create the configuration file
mkdir -p /root/letsencrypt
touch /root/letsencrypt/acme.json
chmod 600 /root/letsencrypt/acme.json
- After running finishes, open the New SFTP window and open the docker-compose.yml file
- Copy the command block below and paste it into the file as shown in the image
traefik:
image: traefik:v2.10
restart: always
command:
- "--api.dashboard=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
- "--entrypoints.websecure.address=:443"
- "--certificatesresolvers.myresolver.acme.httpchallenge=true"
- "--certificatesresolvers.myresolver.acme.httpchallenge.entrypoint=web"
- "--certificatesresolvers.myresolver.acme.email=thanhnhien.cva.93@gmail.com"
- "--certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json"
ports:
- "80:80"
- "443:443"
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- /root/letsencrypt/acme.json:/letsencrypt/acme.json
- Please change to the email you used to register N8N
- The image, restart, command, ports, and volumes lines must be indented inside traefik
- Scroll down, delete the highlighted blue part, and add the command below to that section
labels:
- "traefik.enable=true"
- "traefik.http.routers.n8n.rule=Host(`beiu.online`)"
- "traefik.http.routers.n8n.entrypoints=web,websecure"
- "traefik.http.routers.n8n.tls.certresolver=myresolver"
- "traefik.http.routers.n8n.tls=true"
- "traefik.http.services.n8n.loadbalancer.server.port=5678"
- Replaced as shown in the image below for clarity; please remember to save after editing
Quick note:- traefik must be aligned with n8n:
- Next, access the .env file
- Open the .env file and add the line:DOMAIN=[Your domain]
- Remember to save it
- Next, run the final command to start the N8N container
docker compose up -d
Step 3: Check results
- Access using the newly pointed domain
- If the N8N interface or SSL pending page is displayed, you have successfully attached the domain via Cloudflare.
Wishing you success in pointing your domain to your N8N VPS and discovering powerful automation workflows secured with the great SSL you configured!!
Don't miss the opportunity to use high-quality services with exclusive offers only at VPTS!
- Hotline: 0328 812 674
- Website: https://vpts.shop
- Zalo OA: https://zalo.me/vpstttgroup
Facebook: https://facebook.com/VPSTTT
CONCLUSION
Assigning a domain and enabling SSL for the company's N8N VPSVPTSnot only helps professionalize the system but also ensures safety during data operations. If you encounter installation errors or need configuration assistance, contact the VPTS technical team for the fastest, most detailed support.
VPTS – Comprehensive Digital Infrastructure Solutions Provider
VPTS is a digital infrastructure solution provider in Vietnam, serving deployment, operation, and data storage needs for individuals, developers, and enterprises. The service ecosystem includesVietnam VPS, International VPS, VPS Anti DDoS, Hosting cPanel, dedicated server, Rack rental, Proxy IPv4/IPv6, S3 MinIOandCloud Storage.
Besides providing infrastructure resources, VPTS also focuses on assisting customers with deployment, configuration, and practical troubleshooting. Content on the VPTS Blog is drawn from common scenarios in operating VPS, servers, and online systems, helping readers understand root causes and apply clear solutions.
VPTS – Stable infrastructure, flexible solutions, and continuous partnership throughout operations.
VPTS Team Contact Information
Website: https://vpts.shop
Facebook: https://www.facebook.com/trang.vpsttt/
Zalo OA: https://zalo.me/vpstttgroup
Hotline: 0328 812 674