Prerequisites
Before enabling Gzip compression, make sure you have:
- SSH access to your VPS
- Nginx or Apache server
Method 1: Enable via HestiaCP Web Template
In HestiaCP, edit your domain and select a template that includes gzip (most templates have it enabled by default).
Check if enabled: curl -H "Accept-Encoding: gzip" -I https://example.com | grep Content-Encoding
Method 2: Enable Gzip in Nginx
Edit Nginx main config:
nano /etc/nginx/nginx.conf
Inside http block, add or modify:
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_types text/plain text/css text/xml text/javascript application/javascript application/xml+rss application/atom+xml image/svg+xml application/json;
gzip_min_length 1000;
gzip_disable "msie6";
Test and restart:
nginx -t
systemctl restart nginx
Method 3: Enable Gzip in Apache
Enable mod_deflate:
a2enmod deflate
systemctl restart apache2
Add to .htaccess:
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript
Test Gzip Compression
curl -H "Accept-Encoding: gzip" -I https://example.com
Look for:
Content-Encoding: gzip
Online test: https://checkgzipcompression.com/
Benefits of Gzip
- Reduces file size by 70-90%
- Faster page load times
- Lower bandwidth costs
- Better Core Web Vitals scores
✅ Gzip compression has been enabled!