Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

gzip mod_deflate

Status
Not open for further replies.

glimbeek

Programmer
Nov 30, 2009
83
NL
Hi,

I've been reading up on this and I've been trying out a fair few different .htaccess solutions for my problem but to no avail.

My "problem" is that I want to compress html, css, php, xml, js and maybe images when people send a request to my server AKA visit my website.

Every "solution" I find, doesn't seem to work. As in, nothing get's compressed.

For instance I tried:

<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>

and:

# compress text, html, javascript, css, xml:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript

# Or, compress certain file types by extension:
<Files *.php>
SetOutputFilter DEFLATE
</Files>

But the results are the same, nothing is compressed. If I turn on gzip compression in Joomla the only thing that get's compressed is the basic HTML that's requested. CSS, etc.. isn't compressed.

There are several websites that you can use to "check" if you compress your content and they say my website is actually sending compressed files on request but Yslow or Page Speed tell a different story.

I'm using Joomla and I enabled gzip. It works on some files but on most it doesn't.
I tried installing extensions that do can do this for you, but they don't work flawless. They compress to much and/or in the wrong order which breaks javascript etc..

I looked into google's mod_pagespeed but that's to much Beta at the moment for my liking. Plus I'd need my host to work with me to get it installed and I can't "test" it before I install it. I'd like to test it and make sure my website doesn't break by installing a apache module.

I contacted my host about my compression problems, but they react in a fashion where this isn't a problem and fixing it should be common sense. I however lack the "common sense" to sort this out. So any help is greatly appreciated :)
 
Hi

glimbeek said:
There are several websites that you can use to "check" if you compress your content and they say my website is actually sending compressed files on request but Yslow or Page Speed tell a different story.
So the site is up and accessible. Then tell us the URL, so we can take a look at those responses.

Feherke.
 
Hi feherke,

Thank you for you reply.

I'd rather not for several reasons, like duplicate content etc. I've been testing on my test subdomain which is identical to my real website.

I'm more then happy to create a "log" of yslow/page speed results and post it here. Of course with the url's edited.
 
Hi

Well, I would prefer "manual" analysis, without YSlow & similar tools to see:
[ul]
[li]all unaltered HTTP response headers[/li]
[li]the unaltered content[/li]
[/ul]
and repeat the test for :
[ul]
[li]files of different types[/li]
[li]files of different sizes ( some may be excluded because of file size limits )[/li]
[/ul]
Anyway, I would take a look from the other side too : set the logging to include mod_gzip provided information, make some request, then read the log.


Feherke.
 
Those seem good suggestions.
The access log file as it is right now, doesn't show anything about compression or the lack off.

How do I turn this on? I've got access the cpanel and WHM but I can't find where to do this.
 
Hi

glimbeek said:
How do I turn this on? I've got access the cpanel and WHM but I can't find where to do this.
The [tt]LogFormat[/tt] and [tt]CustomLog[/tt] directives can be used in "Context: server config, virtual host", so search you httpd.conf file ( or kind of httpd/conf/ directory in case the config file is split in pieces ).
Find the one defining the log format and add the [tt]%{mod_gzip_*}n[/tt] placeholders defined by mod_gzip, as shown in its documentation.


Feherke.
 
In the end, my host "rebuild" apache with mod_deflate configured properly and now it works as it should...

Thanks everyone for the input and suggestions!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top