mod_pagespeed

mod_pagespeed

Yet another opensource module by google for apache to speed up the page loading speed. Note that the mod_pagespeed module is still under beta and more stable releases are going to be relased soon. The modules source are now availble on both source and rpm which you can download directly from code.google.com. In this article i have explained about how mod_pagespeed modules works and how to install the modules in the plain centos server and on plesk, cpanel servers.


How mod_pagespeed works?

mod_pagespeed includes several filter that optimize JavaScript, HTML and CSS stylesheets. It also includes filters for optimizing JPEG and PNG images. The filters are based on a set of best practices known to enhance web page performance. Webmasters who set up mod_pagespeed in addition to configuring proper caching and compression on their Apache distribution should expect to see an
improvement in the loading time of the pages on their websites. You can view the video description on youtube below.

http://www.youtube.com/watch?v=8moGR2qf994&feature=player_embedded

Installing mod_pagespeed on Centos / Apache 2.2.x & plesk

The current beta version of mod_pagespeed only supports the Apache 2.2.x version and does not support other older versions so before planning to install this module make sure that you have apache 2.2.x version running in your servers or you can upgrade it to the newer version. Mod-pagespeed works with mod_deflate module so make sure that you have also install it.

mod_pagespeed download :

You can download the rpms from the below url and make sure that you are download the right arch rpm :

http://code.google.com/speed/page-speed/download.html

The rpm install the following files.

  • # rpm -ql mod-pagespeed-beta
    /etc/cron.daily/mod-pagespeed
    /etc/httpd/conf.d/pagespeed.conf
    /usr/lib/httpd/modules/mod_pagespeed.so
    /var/mod_pagespeed/cache
    /var/mod_pagespeed/files

All will be set including the permissions etc usually setup by the rpm itself. All you have to do it to edit the /etc/httpd/conf.d/pagespeed.conf file and change the ModPagespeedUrlPrefix to your server name. For example

  • ModPagespeedUrlPrefix “http://server.gnutoolbox.com/mod_pagespeed/”

You can also alter the cache locations and other setting in the file. Please refer the following url for more details.

http://code.google.com/speed/page-speed/docs/using_mod.html
Restart Apache to load the new module.

  • # /etc/init.d/httpd restart

Installing mod_pagespeed on cpanel servers

Before installing the mod_pagespeed module make sure that you have install the mod_defalte module the complete installation instruction are give here

I have also found a nice installation instruction for cpanel server here

And after installing the module you can find the cache files stored inside the /var/mod_pagespeed/cache/ under your hostname directory. Initially your server load will be high and once cached you will see a reduced load and an increase in the loading speed around 60%.


Useful links :

Modpagespeed home page : http://code.google.com/p/modpagespeed/