Prerequisites
Before setting up web templates, make sure you have:
- SSH access to your VPS
- Root or sudo privileges
What are Web Templates?
Templates in HestiaCP define how Nginx and Apache handle web requests. They control caching, security headers, PHP handling, and more.
Template Locations
Nginx templates: /usr/local/hestia/data/templates/web/nginx/
Apache templates: /usr/local/hestia/data/templates/web/apache2/
PHP-FPM templates: /usr/local/hestia/data/templates/web/php-fpm/
Available Default Templates
# List available templates
ls /usr/local/hestia/data/templates/web/nginx/
Common templates:
- default - Standard configuration
- caching - Static file caching
- proxy - Reverse proxy setup
- wordpress - Optimized for WordPress
- drupal - Optimized for Drupal
Assign Template to Domain via Web Interface
Step 1: Log in to HestiaCP
https://YOUR_SERVER_IP:8083
Step 2: Navigate to WEB Section
Click on WEB in the top menu bar.
Step 3: Edit Domain
Click the gear icon (⚙️) next to your domain.
Step 4: Select Templates
Under Advanced Options, select:
- Web Template: Nginx configuration
- Backend Template: PHP-FPM or Apache
- Proxy Template: Nginx proxy settings
Step 5: Save
Click Save to apply the template.
Assign Template via SSH
/usr/local/hestia/bin/v-change-web-domain-tpl admin example.com wordpress
/usr/local/hestia/bin/v-change-web-domain-backend-tpl admin example.com php82
Create Custom Template
Copy existing template:
cp /usr/local/hestia/data/templates/web/nginx/default /usr/local/hestia/data/templates/web/nginx/custom
Edit the template:
nano /usr/local/hestia/data/templates/web/nginx/custom
Modify as needed, then assign to domain.
Common Template Customizations
Enable Gzip compression: Uncomment gzip lines in template.
Add security headers: Add to server block:
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
add_header X-XSS-Protection "1; mode=block";
Reload Web Server After Template Change
systemctl restart nginx
systemctl restart php8.2-fpm
✅ Web template has been configured successfully!