Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I enable gzip on Dreamhost?

I would like to compress all css and js on my Dreamhost site, I have found suggestions on the web but none of them work. Does anyone have a working example of gzip running on a Dreamhost site?

like image 296
Gerlando Piro Avatar asked Dec 14 '09 21:12

Gerlando Piro


People also ask

How do I know if gzip is enabled?

Double click on the file and select headers. Under 'Response headers' you are looking for the 'Connection-Encoding' field, it will say gzip if it is enabled. NOTE: By default, Deflate is enabled on all of our servers.

How do I enable gzip on my server?

Gzip on Windows Servers (IIS Manager)Open up IIS Manager. Click on the site you want to enable compression for. Click on Compression (under IIS) Now Enable static compression and you are done!

Is gzip enabled by default?

All modern browsers include support for GZIP compression by default. However, to serve the compressed resources to your users with no hiccups, you must configure your server properly.


2 Answers

I'm a bit late to the game here in 2012, but I think this is still relevant. The "mod_gzip" method does not work in Dreamhost's .htaccess files any more. They seem to be using mod_deflate instead.

I removed the mod_gzip block and added the following to my .htaccess file:

AddOutputFilterByType DEFLATE text/html text/plain application/javascript text/css

This did the trick for me. You can also add other file types here in case you have things like XML or JSON - or something that falls outside the norm.

I've gone back and updated the Dreamhost wiki page to add this.

like image 107
Paul Kimbrel Avatar answered Sep 29 '22 00:09

Paul Kimbrel


I haven't tried this yet. But, it might work

<IfModule mod_gzip.c>
  mod_gzip_on       Yes
  mod_gzip_dechunk  Yes
  mod_gzip_item_include file      \.(html?|txt|css|js|php|pl|jpg|png|gif)$
  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>

Source: http://wiki.dreamhost.com/Htaccess_tricks

like image 35
Chris Antonick Avatar answered Sep 29 '22 02:09

Chris Antonick