I have created a server on the centos 6 platform 64 bit and we are currently trying to enable the gzip compression to make our website load faster. Now we have read several different articles to make sure this works first we needed to make sure that module was installed we checked that and it does show as being installed and we also heard that by default it’s installed with the setup of the server we are running the vesta control panel. Based off our research you can set the compression by either doing it on the server or by doing it in the htaccess file so we tried adding it on the server side we tried adding the following code “AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript” in the following file “/etc/httpd/conf/httpd.conf” and still came back with no results every time we do this we are restarting apache to see if it’s takes effect we even rebooted the entire server to make sure everything restarts. We have also tried putting that code in the"/home/admin/conf/web/httpd.conf" as well with the same no results. If somebody can give a step by step on what we may be doing wrong maybe there’s a way to check if gzip is installed with certain commands and also which file do we actually modify to make the compression work. thank you.


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Thats exactly what I mean. You should have Compression enabled then (if the browser supports it)

ok i went into the httpd.conf file and i found this already in the file “Include conf.d/*.conf” is this what you mean or should i add another include pointing to that specific file.

I just mean check that conf.d and sub folders are on the same line as an Include statement that should enable gzip compression for you.

First make sure you have this line in httpd.conf

LoadModule deflate_module modules/mod_deflate.so

Create a new file in /etc/httpd/conf.d called deflate.conf and add the following contents.

#Set to gzip all output
SetOutputFilter DEFLATE

#exclude the following file types
SetEnvIfNoCase Request_URI \.(?:exe|t?gz|zip|iso|tar|bz2|sit|rar|png|jpg|gif|jpeg|flv|swf|mp3)$ no-gzip dont-vary

#set compression level
DeflateCompressionLevel 9

#Handle browser specific compression requirements
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4.0[678] no-gzip
BrowserMatch bMSIE !no-gzip !gzip-only-text/html
SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0

ensure you include this file in your httpd.conf

To check gzip I recommend http://checkgzipcompression.com/