0
votes

I am trying to enable Gzip Compression using .htaccess on a Centos 7.3 server.

This is my phpinfo file: [bluebamboo.com.ar/info.php

I read all this documents and posts:

varvy.com/pagespeed/enable-compression.html

digitalocean.com/community/tutorials/how-to-install-and-configure-mod_deflate-on-centos-7

stackoverflow.com/questions/12576841/gzip-compression-using-htaccess

stackoverflow.com/questions/20520314/enable-gzip-compression

httpd.apache.org/docs/2.2/mod/mod_deflate.html

I check gzip compression in this site: varvy.com/tools/gzip/

I try with this configuration in .htacces file but it doesn't work.

  # Gzip compression varvy.com/pagespeed/enable-compression.html
  <ifModule mod_gzip.c>
  mod_gzip_on Yes
  mod_gzip_dechunk Yes
  mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
  mod_gzip_item_include handler ^cgi-script$
  mod_gzip_item_include mime ^text/.*
  mod_gzip_item_include mime ^application/x-javascript.*
  mod_gzip_item_exclude mime ^image/.*
  mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
  </ifModule>

--

  # https://css-tricks.com/snippets/htaccess/active-gzip-compression/
  <IfModule mod_filter.c>
  AddOutputFilterByType DEFLATE "application/atom+xml" \
  "application/javascript" \
  "application/json" \
  "application/ld+json" \
  "application/manifest+json" \
  "application/rdf+xml" \
  "application/rss+xml" \
  "application/schema+json" \
  "application/vnd.geo+json" \
  "application/vnd.ms-fontobject" \
  "application/x-font-ttf" \
  "application/x-javascript" \
  "application/x-web-app-manifest+json" \
  "application/xhtml+xml" \
  "application/xml" \
  "font/eot" \
  "font/opentype" \
  "image/bmp" \
  "image/svg+xml" \
  "image/vnd.microsoft.icon" \
  "image/x-icon" \
  "text/cache-manifest" \
  "text/css" \
  "text/html" \
  "text/javascript" \
  "text/plain" \
  "text/vcard" \
  "text/vnd.rim.location.xloc" \
  "text/vtt" \
  "text/x-component" \
  "text/x-cross-domain-policy" \
  "text/xml"
  </IfModule>

Here is are my httpd.conf file:

bluebamboo.com.ar/httpd.txt

bluebamboo.com.ar/httpd2.txt

I tried to run commands like "apachectl -t -D DUMP_MODULES |grep deflate" but it does not function.

I really don't know where is the issue. Can you help me?

Thanks in advance.

1
@OlafDietsche I think you link this post...Gonzalo
Ouch, you're right. :-(Olaf Dietsche

1 Answers

0
votes

try

<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

  # Remove browser bugs (only needed for really old browsers)
  BrowserMatch ^Mozilla/4 gzip-only-text/html
  BrowserMatch ^Mozilla/4\.0[678] no-gzip
  BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
  Header append Vary User-Agent
</IfModule>