Just another idiot with a blog
Currently Browsing: Apache

Configuring Google’s Mod_pagespeed for Apache in Fedora or Ubuntu

I recently have been on an incredible optimization kick server and application side and tonight I came across a module for Apache written by Google. Its actually freaking amazing and its running on this site right now. Right now its combining and minifying my css (had a problem with the js and one of these shitty wordpress modules so I left it out), removing whitespace, and caching (yes, awesome.) the list goes on and it improved performance quite a bit (fuck ya?). It’s all done automagically with just a bit of configuration (takes like what, 2 fucking minutes?).

My Speed Improvments

Now I have APC, and Memcache doing some dirty work for me and believe me those two make a HUGE difference already, but after installing this I saw about an average of 33%ish speed improvments. from about 4-5 second page loads (have a lot of external shit on here that im about to get rid of). to about 1.8-3 second page loads. Believe me it makes a huge difference, and I hope this Google Gold helps you out.

If you view the source of this page you’ll notice that there is a lack of whitespace, just one of the optimizations.

Lets install mod_pagespeed

Download it. The commands below are straight from Google’s site where the download is located. But I’m going to give you a quickstart to configure it, down and dirty, even simple.

From what Google says on their page, the Google repository will be added to your system to keep mod_pagespeed upt o date. If you dont want that, just run the following code before you install

sudo touch /etc/default/mod-pagespeed

As root run these if you are in a Debian/Ubuntu Enviornment.

dpkg -i mod-pagespeed-*.deb
apt-get -f install

If you are using Fedora/CentOS

yum install at
rpm -i mod-pagespeed-*.rpm

Now lets configure this sucker.

Debian/Ubuntu Linux distributions

sudo nano /etc/apache2/mods-available/pagespeed.conf

On CentOS/Fedora:

sudo nano /etc/httpd/conf.d/pagespeed.conf

Now that we’re in the file, just paste this configuration in and restart apache and you’re good to go, the automagic happens and it fucking works. Place the code below right before the closing tag so you have your own block of configurations.

ModPagespeedEnableFilters combine_css
ModPagespeedEnableFilters rewrite_css,rewrite_javascript
ModPagespeedEnableFilters inline_css,inline_javascript
ModPagespeedEnableFilters rewrite_images
ModPagespeedEnableFilters insert_img_dimensions
ModPagespeedEnableFilters remove_comments
ModPagespeedEnableFilters extend_cache
ModPagespeedEnableFilters remove_quotes
ModPagespeedDomain http://www.whateveryoursiteis.com

Save the file, and restart apache and notice the huge improvement.

If you want more options, and believe me there are some go to Google directly and read a bit.

Enjoy.

-Wes

Copyright ©2012 wessray.com
Protected by Copyscape Unique Content Validation