Prerequisites
Before setting up DNS templates, make sure you have:
- SSH access to your VPS
- Root or sudo privileges
What are DNS Templates?
DNS templates define which DNS records are automatically created when a new domain is added (A, MX, TXT, etc.).
Template Location
/usr/local/hestia/data/templates/dns/
Default DNS Templates
ls /usr/local/hestia/data/templates/dns/
Common templates:
- default - Standard DNS records
- cloudflare - Ready for Cloudflare integration
- mailonly - Only mail-related records
Assign DNS Template via Web Interface
Step 1: Log in to HestiaCP
https://YOUR_SERVER_IP:8083
Step 2: Navigate to DNS Section
Click on DNS in the top menu bar.
Step 3: Add New Domain
Click + Add DNS Domain.
Step 4: Select Template
Choose a template from the dropdown menu.
Assign via SSH
/usr/local/hestia/bin/v-add-dns-domain admin example.com ns1.example.com ns2.example.com -t cloudflare
Create Custom DNS Template
Copy default template:
cp /usr/local/hestia/data/templates/dns/default /usr/local/hestia/data/templates/dns/custom
Edit the template:
nano /usr/local/hestia/data/templates/dns/custom
Example custom template content:
# A Records
@ A %ip%
www A %ip%
mail A %ip%
# CNAME Records
ftp CNAME @
# MX Records
@ MX mail.%domain%. 10
# TXT Records
@ TXT "v=spf1 mx ~all"
Variables:
- %domain% - Domain name
- %ip% - Server IP address
- %ns1% - Primary nameserver
- %ns2% - Secondary nameserver
Apply Template to Existing Domain
/usr/local/hestia/bin/v-change-dns-domain-template admin example.com custom
✅ DNS template has been configured successfully!