On Sat, Sep 25, 2010 at 20:15, Dave M G
<dave@example.com> wrote:
TLUG,
I'm trying to set up my web sites to use gzip compression and expires
headers.
Naturally, I'm trying to learn from searching the web for instructions
on exactly how to do that.
I found code to add to my .htaccess file, but it doesn't seem to be
working, so I think maybe my host server doesn't have the right Apache
modules enabled.
I think I need modules called mod_gzip and mod_expires.
This is where I've hit a wall. I can't figure out what commands to issue
to confirm the presence or absence of the right modules.
I figure it should be easy, but I've come up with nothing.
Can someone point me in the right direction? To confirm the modules and
enable them if they're not present?
Any advice would be much appreciated.
First of all, what version of Apache are you using? Things have changed between the different releases and I strongly suggest you to go with 2.2.
If you are using 2.x and you have mime types configured it should be as easy as loading the module:
LoadModule deflate_module /...path...to.../mod_deflate.so
The deflate module is actually an output filter basically meaning that Apache will "transform" something on its output. But you need to configure the "what" output to transform (in our case, compress). Look at the various AddOutputFilterBy... directives.
AddOutputFilter DEFLATE html css js
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/_javascript_
Will do the same as above, but considering mime types rather than extensions. To verify that it's actually working, I use CURL as it's the easiest method:
HTTP/1.1 200 OK
Date: Sat, 25 Sep 2010 13:20:03 GMT
Server: Apache/2.2.14 (Ubuntu)
Last-Modified: Wed, 14 Apr 2010 12:36:12 GMT
ETag: "5eb09-61-484319f9066c4"
Accept-Ranges: bytes
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 77
Content-Type: text/html
#
If you see a header Content-Encoding: gzip in the response, bingo, you have a winner!
Hope this helps!
Pier