This is our new series on Apache optimization, here we are introducing a new Google‘s product called mod_pagespeed module for Apache that makes the web site load much faster than ever. I have personally tested this module on our Live (tecmint.com) server and results are amazing, now the site loads much faster then before. I recommend you all to install it and see the results.
In this article we will show you how to install and configure Google‘s mod_pagespeed module for Apache in RHEL 6.3/6.2/6.1/6/5.8, CentOS 6.3/6.2/6.1/6/5.8 and Fedora 12,13,14,15,16,17 systems using Google’s repository so that your system will gets regular updates automatically and stays up to date.
What Is Mod_PageSpeed
Currently mod_pagespeed module supported Linux platforms are RHEL/CentOS/Fedora and Debian/Ubuntu for 32 bit and 64 bit distributions.
Installing mod_pagespeed Module for Apache in RHEL, CentOS and Fedora
As I discussed above that we are using Google‘s repository to install it for future updates, so let’s add the repository to your systems based on your OS architecture.
Step 1: Enabling Google’s mod_pagespeed Repository
Create a file called /etc/yum.repos.d/mod-pagespeed.repo with the help of your favourite editor and add the following lines of code to it based on your OS bit.
[mod-pagespeed] name=mod-pagespeed baseurl=http://dl.google.com/linux/mod-pagespeed/rpm/stable/i386 enabled=1 gpgcheck=0
[mod-pagespeed] name=mod-pagespeed baseurl=http://dl.google.com/linux/mod-pagespeed/rpm/stable/x86_64 enabled=1 gpgcheck=0
Step 2: Installing mod_pagespeed Module for Apache
We use Yum to install the mod_pagespeed on systems, issue below command.
# yum --enablerepo=mod-pagespeed install mod-pagespeed
Step 3: Configuring mod_pagespeed Module for Apache
Above command creates following directories and files.
- /etc/cron.daily/mod-pagespeed : mod_pagespeed cron script for checking and installing latest updates.
- /etc/httpd/conf.d/pagespeed.conf : The main configuration file for Apache.
- /usr/lib/httpd/modules/mod_pagespeed.so : mod_pagespeed module for Apache.
- /var/www/mod_pagespeed/cache : File caching direcotry for web sites.
- /var/www/mod_pagespeed/files : File generate prefix for web sites.
Note : No need of additional configuration because mod_pagespeed automatically Turn On.
Step 4: Verifying mod_pagespeed Module for Apache
To verify mod_pagespeed module, first you need to creat a file called phpinfo.php under root directory of Apache and add the following lines of code to it. For example (/var/www/html/phpinfo.php).
<?php phpinfo (); ?>
Once you created the above file, then restart the Apache service to take new changes. Now access the file phpinfo.php by navigating to your web browser like http://localhost/phpinfo.php. You will see “X-Mod-Pagespeed” section in the HTTP header, similar to below.
Step 5: Turning the Module On and Off
If you don’t want to use mod_pagespeed completely, you can Turn Off by inserting the following line to pagespeed.conf file at the top.
Similarly, to Turn On module, insert the following line to pagespeed.conf file at the top.
As I said above after installing mod_pagespeed our website loads 40%-50% faster. We would really like to know about your website speed after installing it on your systems via comments.
Latest posts by Ravi Saive (see all)
- Google Chrome 39 Released – Install on RHEL/CentOS 7/6 and Fedora 20-15 - November 21, 2014
- Wine 1.7.31 (Development Version) Released – Install in RedHat and Debian Based Systems - November 14, 2014
- Download of The Day: CentOS 7 Released – Download DVD ISO Images - July 8, 2014