Install Google mod_pagespeed with DirectAdmin


Earlier this week, Google released an open source Apache module to simplify the optimization of your content.  The module, mod_pagespeed, will do all sorts of magic like minify your JS/CSS and optimize images, and a handful of other optimizations that seem (from limited testing) to improve your servers performance considerably.

Google has provided a couple of RPM’s to help with installation, unfortunately, if you’re running DirectAdmin on CentOS, they won’t work.  DirectAdmin runs a compiled Apache with some slightly different defaults and installing using YUM or RPM will fail dependency checks.

In this article, I’ll explain how to get around the dependency issues and adjust your configuration.  I have to warn you that this is NOT something I recommend you do on a regular basis unless you’re an experienced Linux Admin, in which case you probably won’t need this tutorial. Overriding RPM dependencies can have some adverse effects on your system.  In this case we know most DirectAdmin / CentOS systems share a very similar configuration, so it’s not much of a risk.

Download a copy of the CentOS RPM or wget it from your shell:

wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-beta_current_i386.rpm <– 32bit
wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-beta_current_x86_64.rpm <– 64bit

Since you’re running on a DirectAdmin server, trying to install using YUM or RPM will fail dependency checks since Apache is built from source.  We’ll have to force the installation and make a couple of changes to our systems configuration files:

rpm -i –nodeps mod-pagespeed-beta_current_.rpm

vi /etc/httpd/conf/extra/httpd-includes.conf

And add the following to the top of the file:

#Google PageSpeed Module
Include /etc/httpd/conf.d/pagespeed.conf

Next you’ll need to edit your main httpd.conf file:

vi /etc/httpd/conf/httpd.conf

Find and remove the line:

Include conf/extra/httpd-deflate.conf

If you’d like to change the options for PageSpeed, it’s configuration file is located in /etc/httpd/conf.d/pagespeed.conf

Once everything is set, we’ll need to restart Apache and test to see if the module loaded properly:

service httpd restart

and

apachectl -t -D DUMP_MODULES | grep pagespeed

If you get the following output, everything should be installed and functioning properly:

Syntax OK
pagespeed_module (shared)

You should also check any .htaccess files you may use and remove any instances of ‘setoutputfilter’ as this will probably override what mod_pagespeed is doing.

There you have it!  Load up a copy of FireFox with the PageSpeed installed and check out how your score has improved.  In my case, with all other caching disabled, I went from a score of 60 to an 82.  Not a bad improvement if you ask me!

 

rpm -i --nodeps (the right version of mod_pagespeed).rpm

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>