Jump to content

On the fly compression in Apache 2.2.*


Recommended Posts

I am trying to make a site that uses GZip compression, and ideally fallbacks to DEFLATE or using no compression at all if GZip is not supported.If only there was a way, I'd also pre cache both DEFLATE and GZip archives, and serve whatever version is lighter/supported, but I've never seen anything like that.I found mod_gzip which seems to be what I need (though not exactly what I dreamed for), but it's made for Apache 1.3 series, and I use Apache 2.2.6. I remember also once finding a special version for Apache 2.2.2, but that version only raises error 500 on Apache 2.2.6 (once the module is loaded... I don't even need to do any other configuration adjustments).For Apache 2.2, I gather Apache includes mod_deflate which offers both kinds of compression. However, all of my attempts to estabilish any compression have failed. I have either got a 500 error (internal server configuration), an invalid file (because the browser sees the file as compressed when it's not), or a working file, but with no compression (I analyze whether compression was applied with Fiddler).Note that I'm trying to compress JS and CSS files. The HTML is generated with PHP, and I've let PHP do a GZip compression on its own.The only way that I was able to do compression was by parsing JS and CSS files with PHP, also adjusting the MIME type within .htaccess. The problem is this is a needless performance penalty, since PHP is initiated just to do the compression, and not to do anything dynamic. If I needed PHP to do anything else with those CSS and JS files, I'd also use PHP for the compression, but I don't. This is why I'm trying to do it on the Apache layer.Has anyone ever succeeded in estabilishing compression and what configuration did you used? I'm looking for success stories, as the ones from the documentaion don't seem to work for me.[edit]SOLVED. It turned out I didn't had mod_deflate and mod_headers loaded and that for some reason I can't enable them with .htaccess. Good enough for now.[/edit]

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...