My Magento site is running on a VPS with Server version: Apache/2.4.23 (Unix) PHP Version => 5.5.38

The following optimization in place: Merge JS/CSS Magento compilation Redis Server Opcache lesti FPC Mod_Pagespeed

My site is quick enough https://gtmetrix.com/reports/www.modmybike.in/fdHza8gN but my ttfb is quite high and I want to reduce the TTFB. I am ready to sacrifice the under 2 sec page load speed for quicker connection and TTFB.

I believe the TTFB is high due to Gzip compression.

I have tried to remove the Apache Gzip compression by trying the following methods.

  1. Removed the text/html mime type from AddOutputFilterByType DEFLATE in .htaccess
  2. SetEnvIf Request_URI "(/)" no-gzip dont-vary in .htaccess
  3. Disabled mod_deflate entirely in .htaccess
  4. Moved from using .htaccess to httpd.conf and explicitly set "SetEnv no-gzip 1"
  5. Removed compress in Lesti::FPC
  6. Compression not enabled in Mod_Pagespeed.

Even with all the above attempts the Accept Encoding is still set to 'gzip, deflate'. I have been on this from last 2 weeks without any progress.

My only option i can think of is to rebuild Apache without mod_deflate.

Edit : Commented out #LoadModule mod_deflate in httpd.conf.

httpd -M still lists mod_defalte as a loaded module after restart.

Please help.


Accept Encoding is a request header. This comes from your browser to the server telling the server that this browser will accept the gzip or deflate compression. If the server does compress the resource it will respond with Content-Encoding: gzip.

I am doubtful that you will gain any speed-up with disabling gzip as it is very fast.

However, as this it is hard to tell exactly how to do this since I do not know whether you have only one web server, or a proxy as well which may be introducing compression, and what you actual configuration is...

It looks like you've already done some of this but here's what you should look at:

  • .htaccess
  • httpd.conf
  • Virtual Host configuration file: somewhere in /etc/httpd/conf.d (take a look at httpd.conf for an include statement pointing to the directory where virtual host files may be located)

In general it seems that if you disable mod_deflate in httpd.conf you should be good, as is outlined here: https://scottlinux.com/2012/09/13/disable-http-compression-in-apache/


$ sudo a2dismod deflate

Module deflate disabled. Run '/etc/init.d/apache2 restart' to activate new configuration! $ sudo /etc/init.d/apache2 restart

Red Hat or CentOS: $ sudo nano /etc/httpd/conf/httpd.conf Comment out this line:

LoadModule deflate_module modules/mod_deflate.so

It should now look like this:

#LoadModule deflate_module modules/mod_deflate.so

Close and save the file then restart httpd:

$ sudo /etc/init.d/httpd restart

Hope this helps :)

| improve this answer | |
  • Thanks @nikola99. The link shared was my first attempt at disabling gzip. That didn't work. I am running only web server and no proxy server. I read elsewhere that Mod_deflate is part of Apache 2.4 hence thinking of Apache rebuild. – Modmy Jan 15 '17 at 7:45
  • Hmm, that's strange. Well, good luck to you! If I were you I would not spend too much time on this, since I am doubtful it will help you much. Also, gzipping your content is one of the recommendations to speed up your sites response. – nikola99 Jan 15 '17 at 22:25

Found that mod_deflate is a static module. Only an Apache rebuild can completely disable compression.

Moving on to setting up an Nginx stack now.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.