server side compression | gzip and apache2 with mod_deflate

Get help with installation and running phpwcms here. Please do not post bug reports or feature requests here.
Post Reply
User avatar
Jensensen
Posts: 3000
Joined: Tue 17. Oct 2006, 21:11
Location: auf der mlauer

server side compression | gzip and apache2 with mod_deflate

Post by Jensensen »

one of my interests since many years is the way how to compress html pages, content, scripts and css on server side.
http://developer.yahoo.com/yui/
http://developer.yahoo.com/performance/rules.html
http://en.wikipedia.org/wiki/Gzip
http://www.csscody.com/use-gzip-components
much more...

i remember those times when 14 kilobytes was outer limits. and i remember also i've built pages which loads all the necessary content and images into the cache at once - with only one page call. somewhere I have a backup on a floppy-disk. 8)
today it's much more difficult. many pages nowadays load hundreds of kilobytes into the browser-ram. no problem anyhow. but speed and performance may be critical.

Today i had time for experiments and found good solutions.
For example, add one of these into your htaccess.

Code: Select all

<IfModule mod_deflate.c>
	<FilesMatch "\.(css|js|xml)$">
		SetOutputFilter DEFLATE
	</FilesMatch>
</IfModule>
better results i got with this one:

Code: Select all

<IfModule mod_deflate.c>
	<FilesMatch ".*\.(html|php|css|js|xml)$">
		SetOutputFilter DEFLATE
	</FilesMatch>
	AddOutputFilterByType DEFLATE application/rss+xml
	AddOutputFilterByType DEFLATE application/xml application/xhtml+xml
	AddOutputFilterByType DEFLATE application/javascript application/x-javascript
</IfModule>

Now let's compare some of these lines:

Code: Select all

	<FilesMatch "\.(css|js|xml)$">

Code: Select all

	<FilesMatch ".*\.(html|php|css|js|xml)$">
What's best?
What's the best way to compress contents of the page?
What experience do you have with compression?
What solutions do YOU use?
{so_much} | Knick-Knack. | GitHub
Umlaute im URL sind meistens immer Kacke.
User avatar
update
Moderator
Posts: 6455
Joined: Mon 10. Jan 2005, 17:29
Location: germany / outdoor

Re: server side compression | gzip and apache2 with mod_deflate

Post by update »

It's rather a question of how the server is configured.
I used to use mod_gzip but not all hosters are able to configure their apache the correct way, i.e. mod_gzip has to be loaded as the last of all other modules otherwise it will not be able to do anything.
What about

Code: Select all

$phpwcms['compress_page']     = 0; //0 = OFF, 1-9: page compression ON (1 = low level, 9 = highest level)
Did you try this one?
It's mostly all about maintaining two or three customer's sites Still supporter for the band Mykket Morton. Visit Mykket Morton on FB. Listen Mykket Morton and live videos on youtube.
Now building a venue for young artists to get wet on stage, rehearsal rooms, a studio, a guitar shop - yes I'm going to build some guitars.
User avatar
Jensensen
Posts: 3000
Joined: Tue 17. Oct 2006, 21:11
Location: auf der mlauer

Re: server side compression | gzip and apache2 with mod_deflate

Post by Jensensen »

I wonder that most articles are four or more years old. maybe i'm very late.
As far as I know mod_gzip was a module for apache 1.x - old, but still working, sometimes faster. mod_deflate is built-in apache 2.x and needs less memory, configuration...

http://evolt.org/node/60104/
mod_deflate is included in the Apache 2.0.x source package
http://www.webcompression.org/gzip-compress.html
http://www.linuxjournal.com/article/6802
http://phpperformance.de/mod_gzip-mod_d ... b-inhalte/
1) Ja, mod_gzip ist für apache 1.3.x und mod_deflate für die 2.0/2.2-Serie, wobei mod_deflate trotz des namens nicht nur deflate-komprimierung sondern gzip nutzt.
comparatively the best one is
http://betterexplained.com/articles/how ... mpression/

CONF $phpwcms['compress_page']
oops, i've totally forgot. thank you.
It's working? I thought, it has been depreciated, isn't it? Did you try? What happens then? Let's see...


I'm not sure with the syntax in general. And, in fact I have no idea, no plan how to use it, what to change, why. I couldn't find a detailed manual or description how to use mod_deflate with htaccess. Many snippets of code. Every author claims his or her version. Examples and variations are missing. Very unsatisfying.

In my ears I hear OG shouting (writing loud): "RRrrr, do not touch things you don't understand!"
Grrr, yes, will need more infos [desk search...]...
{so_much} | Knick-Knack. | GitHub
Umlaute im URL sind meistens immer Kacke.
User avatar
update
Moderator
Posts: 6455
Joined: Mon 10. Jan 2005, 17:29
Location: germany / outdoor

Re: server side compression | gzip and apache2 with mod_deflate

Post by update »

Jensensen wrote:<IfModule mod_deflate.c>
   <FilesMatch "\.(css|js|xml)$">
      SetOutputFilter DEFLATE
   </FilesMatch>
</IfModule>
This should do it - doesn't it?
It's mostly all about maintaining two or three customer's sites Still supporter for the band Mykket Morton. Visit Mykket Morton on FB. Listen Mykket Morton and live videos on youtube.
Now building a venue for young artists to get wet on stage, rehearsal rooms, a studio, a guitar shop - yes I'm going to build some guitars.
Post Reply