Install Google mod_pagespeed

Comments Off on Install Google mod_pagespeed

Install Google mod_pagespeed

Fast and optimized pages lead to higher visitor engagement, retention, and conversions. Google mod_pagespeed si an Apache module for Website Optimization which is a Google invention and it is an wonderful module to help you optimize the performance of your website. As it is a Google invention you can use it with confidence. You need very little effort to install Google mod_pagespeed module. In this I article I will show step by step how to install Google mod_pagespeed Apache module in CentOS/Redhat/Fedora.

  1. Download latest stable version of rpm from https://developers.google.com/speed/pagespeed/module/download . At the right corner you will find latest rpm.
    You can install latest beta version which give you some advanced features. The beta version is also almost stable with more feature enabled.
  1. Check your server architecture
      # uname -a
      Linux localhost.localdomain 2.6.32-220.el6.x86_64 #1 SMP Wed Nov 9 08:03:13 EST 2011 x86_64 x86_64 x86_64 GNU/Linux
  1. Download the rpm according to your server architecture
    wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_x86_64.rpm
  1. Install the rpm
     # rpm -Uvh mod-pagespeed-stable_current_x86_64.rpm
     warning: mod-pagespeed-stable_current_x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 7fac5991: NOKEY
     Preparing...                ########################################### [100%]
     1:mod-pagespeed-stable   ########################################### [100%]
     job 1 at 2014-07-09 22:51
  1. Check mod_pagespeed is installed and activated perfectly
     # apachectl -M | grep pagespeed
     pagespeed_module (shared)
  1. The mod_pagespeed is enabled automatically  as soon as you install it . The global configuration file is /etc/httpd/conf.d/pagespeed.conf which by default includes all necessary configurations. The basic settings parameters of configuration files are:mod_pagespeed :It is by default on. To completely disable mod_pagespeed, you can set this to “off”.ModPagespeedInheritVHostConfig : Default on. We want VHosts to inherit global configuration. If this is not included, they’ll be independent (except for inherently global options), at least for backwards compatibility.AddOutputFilterByType MOD_PAGESPEED_OUTPUT_FILTER text/html : Direct Apache to send all HTML output to the mod_pagespeed output handler.
  1. If you want to moderate PageSpeed at virtual label, it is recommended common parameter should be configured at global label and domain specific parameter should be configured at virtual host label.  Like at global label mod_pagespeed is set to on but for any particular virtual host you want to set it off  then the virtual host configuration would be
<VirtualHost *:80>
DocumentRoot /www/example
ServerName www.example.org
# mod_pagespeed off for this virtual host
ModPagespeed Off
</VirtualHost>
  1. You can check the statistics of PageSpeed module.  At the time of writing this blog current stable version support mod_pagespeed_statistics handler. The configuration is like below
<Location /mod_pagespeed_statistics>
Order allow,deny.
Allow from localhost
Allow from 127.0.0.1
Allow from 104.231.105.30
SetHandler mod_pagespeed_statistics
</Location>

You can access the statistics by http://www.example.org/ mod_pagespeed_statistics . It is mentioned that ip 104.231.105.30 is an example ip from which you are browsing. For beta version (that may be replaced to stable version anytime) support pagespeed_admin handler which give you more administrative access and information. The configuration is as follows

<Location /pagespeed_admin>
Order allow,deny
Allow from localhost
Allow from 127.0.0.1
Allow from 104.231.105.30
SetHandler pagespeed_admin
</Location>

You can access the admin statistics by http://www.example.org/pagespeed_admin

The article “install Google mod_pagespeed” is a short description of PageSpeed module installation. You will have the details information from https://developers.google.com/speed/pagespeed/module/using. As mod_pagespeed is actually an Apache module , so website using Apache web server will be able to take its advantage. There is another popular Webserver Nginx for which Google developed another module called ngx_pagespeed which description you will find in install pagespeed module for Nginx