Can't configure apache to clear all F grades!

If anyone with apache knowledge can advise, I would be very grateful.

I spent a day trying to optimise my httpd.conf and did see good improvements but have reached the end of my limited understanding.

This is where it has got to:

One bit that is bugging me is my failure to GZIP encode all text assets (the main html file):

FAILED - (43.8 KB, compressed = 6.1 KB - savings of 37.7 KB) - Ladies Gloves

The apache config I added was:

<FilesMatch “.(php|css|htm|html|xml|txt|js|pl|jpg|jpeg)$”>
SetOutputFilter DEFLATE

This did apparently compress the CSS file, but not the main page html file.

My other problem is in compressing images. If I tell apache NOT to compress jpg/jpeg files, then the initial load is 2s (25%) slower for this page. However, WPT still gives me a F and still lists the same jpg files as needing compression, even when I am compressing them and the page load is clearly faster.

Now I know a better solution would be to compress images before hand, not on the fly, but why does WPT show a faster load but still report the problem? Is it because it is simply unhappy with what it finds after unpacking the images, despite the fact they were handed over compressed? Is my only fix to better optimise the original images on this site? If so, any Mac OS X / Windows tools I can drop lots of files in and have them come out lighter (so our staff can do the work, not me using command line tools!).

Thanks for any insights, would love straight A grades!


Are the html files actually html files on disk or are they using a rewrite rule to go to php or some other dynamic language?

As far as image compression goes, you won’t be able to do that through apache - you don’t want to gzip images. You need the jpeg images to be compressed at a lower image quality and you could either do it as a batch process or do it as part of the publishing process but you don’t usually want to do that inline. It shouldn’t be too hard to throw together a script that uses imagemagik to recompress all images to a quality level of 75 or 85.

I don’t know how possible it would be on your platform but if you could combine the individual images for each color into a combined image (and use an image map or sprite) you could eliminate a lot of the individual image requests and speed things up a LOT.

The HTML files are dynamically generated by an app server behind the web server (using Apple WebObjects). Can this not then be compressed on the way out, or do I need a different apache config?

Thanks for the image compression techniques, we have gone through this process and now all is ok on that front.

Thanks also for the tip on using a single image with image map. I have started to understand that numbers of resources / round trips is a key problem in performance.


You can do it by mime type instead of just file extension:

<IfModule mod_deflate.c>
	AddOutputFilterByType DEFLATE text/plain	
	AddOutputFilterByType DEFLATE text/html
	AddOutputFilterByType DEFLATE application/xhtml+xml
	AddOutputFilterByType DEFLATE application/xml
	AddOutputFilterByType DEFLATE text/xml	
	AddOutputFilterByType DEFLATE text/css
	AddOutputFilterByType DEFLATE text/javascript
	AddOutputFilterByType DEFLATE application/javascript
	AddOutputFilterByType DEFLATE application/x-javascript
    AddOutputFilterByType DEFLATE application/json

That should work a bit better for dynamically generated content.

I had actually tried that route and the same results (it is in place now). The source for the page contains:

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

which I assume should match on “text/html”?


Check the actual HTTP headers. Apache doesn’t look at meta headers within the payload. There could also be another rule somewhere else that may be breaking it (check your htaccess and httpd.conf for downgrade or force-response-1.0

Well, there was (now commented out):

#BrowserMatch “Mozilla/2” nokeepalive
#BrowserMatch “MSIE 4.0b2;” nokeepalive downgrade-1.0 force-response-1.0
#BrowserMatch “RealPlayer 4.0” force-response-1.0
#BrowserMatch “Java/1.0” force-response-1.0
#BrowserMatch “JDK/1.0” force-response-1.0

Here is what curl says about the headers:
curl -I
HTTP/1.1 200 Apple
Date: Mon, 28 Nov 2011 17:09:11 GMT
Server: Apache/2.2.21 (Amazon)
connection: close
content-length: 12819
Content-Type: text/html; charset=UTF-8

still doesn’t want to compress the main file returned

Thanks for your amazing help to this point and no problem if you don’t have further ideas.

Sorry, you’ve reached beyond my area of expertise (particularly with the Apple Web Objects side of things). It might be worthwhile to see if you can gzip directly at the app server, particularly if Apache is proxying the requests through and not running it as a cli.

I have found a WebObject thread that touches on this:
which suggests that there should be a config file for that adaptor specifically e.g. /Library/WebObjects/ Adaptors/Apache2.2/apache.conf containing:
SetOutputFilter DEFLATE
though that file path is a MacOS path and I can’t see an equivalent config file on Amazon Linux
I will try to resurrect the thread and that list and post back if I find a solution.
Zipping at the app server is possible using a framework called Wonder, though I am not currently using that framework.

TWO of our Pools Plans are amongst the top ten all-time winners and in 08/09 two members here benefited from five figure Pools wins. Just click on the New Football Pools link above if you want to have a go - you do not even have to subscribe here. The help we can give you though is substantial. As the winner has said to us, "I still feel I have done much better with betting overall since joining the site. So again I thank you and your team at soccerlotto for all the hard work."But we’re not just about winning tips, thousands of plans, or an incredibly friendly, jokeful and helpful message board used by professional gamblers. We do data, too, and we do it large and in many unique, fan-intriguing, punter-friendly formats. There’s around 500,000 pages of it, updated daily, and members access around 185 different pages per week here on average. Now you can get some of that on your site for nothing - and collect fees. Click here to find out how.
Members here have become BIG WINNERS since 2001. The camaraderie on our Forum is just fantastic and the insider info even better. Our subscription system means that members can pounce before the World and Mrs World know what’s going on. Our winning NAP on December 6th (Hemel Hempstead, yes, Hemel Hempstead) was flagged A WEEK beforehand and tipped at 6/4 on December 4th. By kick off they were 8/13 lol.
You can now arrange your own choice from 38 sport and lotto newsfeeds here, too. The 1000+ Pools Plan interactive service where you can pick or check virtually ANY plan in seconds has proved a hit. Top right you can see a Daventry syndicate waving a Littlewoods cheque for ? 1,247,000 which they won with ONE OF OUR POOLS PLANS. In September 2008, it was our Pools Tips that changed someone’s life, because they caught all the draws and he was one of three top winners on Littlewoods that week. Maybe one of our 100 EUROMILLIONS plans or 250 LOTTO Plans can put YOU on Cloud Nine.
So what are you waiting for? You have nothing to lose because you can dump us for nothing after three weeks if you don?t like us. And we have nothing to lose by making this offer because so many people stay with us!Seo web directory and Free web directory