I was introduced to Google’s mod_pagespeed at my current place of employment. I dismissed it at first until I was tasked with adding it to one of our existing web apps that didn’t have it yet. Wow. KeepAlive + mod_pagespeed is fantastic. I know KeepAlive is old but it’s still off by default in Apache’s HTTPd config and, all by itself, it gives you a 3x savings in some cases I’ve tried. That, and mod_pagespeed brings you stuff like auto-bundling certain css and javascript into a single request, minifying javascript files and inline javascript, compressing images, generating optimized/rescaled images based on IMG tag width/height, etc. and it goes on. It’s a brilliant “best of breed” (forgive me for saying that!) compilation of all the best web performance techniques. Here’s how to install it…
This is really basic. It’s almost plug’n’play. Go to the mod_pagespeed download page and grab the latest stable version package. Then run `rpm -i mod-pagespeed-stable_current_x86_64.rpm` to install it. It will install a yum repository and all the files and conf needed for mod_pagespeed itself. Then run `service httpd graceful` to restart Apache HTTPd.
Now, open your browser and, before you do anything, open the network console. Then visit one your web pages. The first request will look normal. Pagespeed is analyzing the request the first time. This’ll happen every time you restart httpd I believe.
One last thing. When developing you’ll often want to clear Pagespeed’s cache of files or else your changed files won’t appear for you. Here’s how: run `touch /var/cache/pagespeed/cache.flush`.
By the way, one thing pagespeed allows is for developers, testers and the production environment to have the full, unminified versions of css and javascript meaning developers can turn off pagespeed and, when errors occur in the browser console, you can easily go to the line of the file with the error.
Good luck! Hope you love the change as much as I did!