KNOWNHOST KNOWLEDGE BASE

Hosting Question? Find the Solution - Browse our Guides, Articles, and How-To's

How to Enable Apache Gzip Compression (mod_deflate) in DirectAdmin ?

Gzip compresses the content before serving it to the requested client. Due to the compression of the files, its effectiveness accelerates the website performance to the next level. Learn, How to Enable Apache Gzip Compression (mod_deflate) in DirectAdmin ?


How to check Gzip Compression status?

Just like for every other apache server, you can use the following command to check the Gzip compression (mod_deflate) status,

httpd -M | grep deflate

Result of the above command should look like this,

[root@host ~]# httpd -M | grep deflate
 deflate_module (static)

Enable Gzip Compression (mod_deflate)

DirectAdmin doesn’t have a dedicated option to enable Gzip compression manually using the end-user GUI DirectAdmin control panel. To setup, the Gzip compression (mod_deflate), enter the following code in the .htaccess file,

# BEGIN DEFLATE COMPRESSION
<IfModule mod_deflate.c>
# Compress HTML, CSS, JavaScript, Text, XML and fonts
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/x-font-otf
AddOutputFilterByType DEFLATE application/x-font-truetype
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE font/opentype
AddOutputFilterByType DEFLATE font/otf
AddOutputFilterByType DEFLATE font/ttf
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE image/x-icon
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/xml
</IfModule>
# END DEFLATE COMPRESSION

Conclusion

Now that we’ve gone over how to enable apache GZip compression (mod_deflate) on the DirectAdmin control panel. If you’re not able to track down whether the Gzip compression is enabled or not, refer to this article: How to Check Whether Gzip Compression is Working? or get in touch with our support.

KnownHost offers 365 days a year, 24 hours a day, all 7 days of the week best in class technical support. A dedicated team ready to help you with requests should you need our assistance. You’re not using KnownHost for the best webhosting experience? Well, why not? Check with our Sales team to see what can KnownHost do for you in improving your webhosting experience.