Computer Tips - Apache 2.4: Enable gzip compression (to save bandwidth speed up your website)

Date: 2024mar27 Product: Apache Q. Apache 2.4: Enable gzip compression (to save bandwidth speed up your website) 1. Ensure the module(s) are loaded In your main Apache config file (almost always /etc/httpd/http.conf) make sure these two lines are uncommented - ie don't start with a #
LoadModule deflate_module modules/mod_deflate.so LoadModule filter_module modules/mod_filter.so
They don't occur beside each other in the file. 2. Tell Apache which files to compress I suggest making a file called /etc/httpd/conf.d/mydeflate.conf containing:
<IfModule mod_deflate.c> # Common web text-like files. Don't attempt to compress images 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>
3. Restart Apache
systemctl restart httpd
4. Check your site at https://www.giftofspeed.com/gzip-test