Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: [tlug] Testing Apache for gzip modules
- Date: Sat, 25 Sep 2010 22:14:09 +0900
- From: Pier Fumagalli <pier@example.com>
- Subject: Re: [tlug] Testing Apache for gzip modules
- References: <4C9DD9C2.8090903@example.com>
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.soThe 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.You can add the filter by extension (see http://httpd.apache.org/docs/2.0/mod/mod_mime.html#addoutputfilter), for example this will compress all URIs ending in .html, .css, or .js:AddOutputFilter DEFLATE html css jsBut for example won't catch the home page of your site http://mysite.dom/ (as it doesn't end with one of those extensions). But you can add the same filter inspecting the mime type (see http://httpd.apache.org/docs/2.0/mod/core.html#addoutputfilterbytype) for example:AddOutputFilterByType DEFLATE text/htmlAddOutputFilterByType DEFLATE text/cssAddOutputFilterByType 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:# curl -D /dev/stderr -s --compressed http://127.0.0.1/ > /dev/nullHTTP/1.1 200 OKDate: Sat, 25 Sep 2010 13:20:03 GMTServer: Apache/2.2.14 (Ubuntu)Last-Modified: Wed, 14 Apr 2010 12:36:12 GMTETag: "5eb09-61-484319f9066c4"Accept-Ranges: bytesVary: Accept-EncodingContent-Encoding: gzipContent-Length: 77Content-Type: text/html#If you see a header Content-Encoding: gzip in the response, bingo, you have a winner!Hope this helps!Pier
- Follow-Ups:
- Re: [tlug] Testing Apache for gzip modules
- From: Dave M G
- References:
- [tlug] Testing Apache for gzip modules
- From: Dave M G
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] Ubuntu on just 256 MB?
- Next by Date: Re: [tlug] Ubuntu on just 256 MB?
- Previous by thread: Re: [tlug] Testing Apache for gzip modules
- Next by thread: Re: [tlug] Testing Apache for gzip modules
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links