Question : Apache webserver Linux and Gzip

Hi,

We have a Red Hat server with Apache web server.
We would like to use Gzip to speed up our sites but when we tried it was always Gzipping even if the requesting browser did not support Gzip, which caused problems with Google crawler for sponsored Ads.

Can anyone please advise?



Kind Regards,

Daniel

Answer : Apache webserver Linux and Gzip

From my understanding, mod_gzip doesn't play well with ColdFusion. Also, if you are also hosting Drupal or Joomla sites, do not use the Apache mod_gzip module. It has authenticated and unauthenticated session isssues (i.e. it tries to do douple compression, thus crushing the site -- just displaying white pages). Drupal actually has a gzip module to fix this issue.

As for Apache mod_deflate, I designed a deflate.conf that can be dropped in the /etc/httpd/conf.d directory, so that is has global mod_deflate capibilities.

As an added bonus, you can also add the following line to your httpd.conf or virthost entry to actually see the deflating ratio:
CustomLog /path/to/the/deflate_log deflate
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
<IfModule mod_deflate.c>

SetOutputFilter DEFLATE
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \.(?:exe|t?gz|zip|bz2|sit|rar)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \.pdf$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \.avi$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \.mov$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \.mp3$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \.mp4$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \.rm$ no-gzip dont-vary

 <FilesMatch "\.(js|css|html|xml|x?html?|php)$">
  AddOutputFilterByType DEFLATE text/plain
  AddOutputFilterByType DEFLATE text/html
  AddOutputFilterByType DEFLATE text/xml
  AddOutputFilterByType DEFLATE text/css
  AddOutputFilterByType DEFLATE application/xhtml+xml
  AddOutputFilterByType DEFLATE application/xml
  AddOutputFilterByType DEFLATE image/svg+xml
  AddOutputFilterByType DEFLATE application/rss+xml
  AddOutputFilterByType DEFLATE application/atom_xml
  AddOutputFilterByType DEFLATE application/x-javascript
  AddOutputFilterByType DEFLATE application/javascript
  AddOutputFilterByType DEFLATE application/json
  AddOutputFilterByType DEFLATE application/x-httpd-php
  AddOutputFilterByType DEFLATE application/x-httpd-fastphp
  AddOutputFilterByType DEFLATE application/x-httpd-eruby
  AddOutputFilterByType DEFLATE text/html
 </FilesMatch>

DeflateCompressionLevel 5

BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

DeflateFilterNote Input instream
DeflateFilterNote Output outstream
DeflateFilterNote Ratio ratio

LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate

</IfModule>
Random Solutions  
 
programming4us programming4us