• Home
  • About Us
  • Contact
  • Privacy Policy

LinuxAdmin.io

  • Home
  • Tutorials
    • System Administration
    • Linux Tutorials
    • Web Hosting
    • WordPress
    • Virtualization
    • Troubleshooting
    • OpenStack

Install mod_deflate on Apache

How to install mod_deflate

Mod_deflate is an apache module. Prior to having mod_deflate it was mod_gzip. Post apache 2.0 mod_deflate is used, it provides a slightly better compression than mod_gzip. It allows the size of certain file types to be compressed which in-turn allows clients to be able to download these files faster. This will cause the site itself to load faster for the clients as well as part of the formula for better page ranking. You can read more about mod_deflate on Apache.org.

Requirements:

This guide assumes you already have Apache running as a webserver. If you don’t, please see Install Apache on CentOS

Enable the mod_deflate module

The deflate module is part of the apache core package, so there is no need to compile additional modules, all that is required is to enable in the Apache configuration.

Verify its not already loaded:

# httpd -M 2>&1|grep deflate
#

Edit the main Apache configuration:

nano /etc/httpd/conf/httpd.conf

Un-comment the following line:

LoadModule deflate_module lib/apache/mod_deflate.so

 

Restart apache to confirm the module loaded

service httpd restart

Check for the loaded module again, you should see it return a result

# httpd -M 2>&1|grep deflate
 deflate_module (shared)

Configure mod_deflate

Create a new configuration file:

nano /etc/httpd/conf.d/deflate.conf

Add the following

<filesMatch "\.(js|.css|html|txt)$">
 SetOutputFilter DEFLATE
 </filesMatch>
 DeflateCompressionLevel 7
 DeflateMemLevel 8
 DeflateWindowSize 10

DeflateCompressionLevel – this is the compression level applied, the default is 9, which is the highest level. The higher the compression level the more CPU it will use.
DeflateMemLevel – The amount of memory zlib, the compressing library can use. The default value is also 9, which is the highest.
DeflateWindowSize – The compression window size.  By default the value is 15 which is the highest level.

This will compress .js, .css, .html,  and .txt files. Attempting to compress images will actually return a larger file size so mod_deflate only really provides an advantage on text based files.

Once you have added the configuration settings, you would then just restart Apache to load everything in.

service httpd restart

That is it for adding mod_deflate to Apache.

 

 

 

Jun 26, 2017LinuxAdmin.io
0 0 votes
Article Rating
FFMpeg Install On CentOS 7How To Setup SSH Key Authentication
You Might Also Like
 
Nginx Load Balancing
 
Block Countries With Nginx and GeoIP
Subscribe
Notify of
guest

guest

0 Comments
Inline Feedbacks
View all comments
7 years ago Apache, Linux System Administration, Web Hosting centos, Linux Performance Tuning2,842
Recent Posts
  • Configuring Firewalld to Work Seamlessly with Docker on CentOS
  • Mastering NGINX Tuning: Optimizing Web Server Performance
  • Exploring eBPF: Revolutionizing Network and System Monitoring
  • Kubernetes: Installation and Overview on CentOS 8
  • Install Docker on Centos 8
Most Commented
Hot Clone Linux Server with Rsync
Hot Clone A CentOS Server With Rsync
14 Comments
ngx_cache_purge module
Install The ngx_cache_purge Module In Nginx
8 Comments
piwik-nginx
Piwik Analytics on Nginx
8 Comments
Tags
linuxcentosLinux Performance Tuningsysadminkvmnetworkingmemcachedanalyticssystemd
About

We love Linux and are dedicated to creating Linux administration tutorials for System Administrators since 2016.

Most Viewed
Default Gateway
How To Configure A Default Gateway on CentOS
76,144 views
Zend Opcache
Setup and Optimize Zend OpCache
47,105 views
Install ffmpeg
FFMpeg Install On CentOS 7
21,675 views
Archives
Email subscription

Sign up for our newsletter to receive the latest news and event postings.

2018 © LinuxAdmin.io
wpDiscuz