How to install Apache mod_pagespeed on CentOS with Plesk

Apache-LogoI bumped into Kristian Markroft from Simplyroot in New Orleans last week, and he told me about an interesting speed-up module for the Apache Webserver.

mod_pagespeed is an open source project which speeds up page loads without having to change the code of the actual page. mod_pagespeed does this by adding filters before pages are served. For example it will resize images and minify CSS/JS files, which can speed up page load considerably. The project is hosted on Google Code:

Let’s see how we can install it on CentOS, test to see if it works and how to manage it in Plesk.

Installing mod_pagespeed

The easiest way to install the module is by pulling the pre-built packages via yum from Google. For this we need to add a new source for yum to access. This source only contains the mod_pagespeed module, none of your other packages will be affected (even when you casually yum update your server).

Let’s add it by creating the following file:

vi /etc/yum.repos.d/google-mode-pagespeed.repo

Add the following code block to it:


In case you’re not familiar with vi: hit a to enter edit mode, paste your code, hit escape followed by shift-Z-Z to save and exit.

Now we can install the module:

yum install mod-pagespeed

 Package              Arch     Version             Repository              Size
 mod-pagespeed-beta   x86_64       google-mod-pagespeed   5.0 M
Installing for dependencies:
 at                   x86_64   3.1.10-43.el6_2.1   base                    60 k

Transaction Summary
Install       2 Package(s)

Total download size: 5.0 M
Installed size: 13 M
Is this ok [y/N]: y
Downloading Packages:
(1/2): at-3.1.10-43.el6_2.1.x86_64.rpm                   |  60 kB     00:00     
(2/2): mod-pagespeed-beta-       | 5.0 MB     00:01     
Total                                           2.4 MB/s | 5.0 MB     00:02     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : at-3.1.10-43.el6_2.1.x86_64                                  1/2 
  Installing : mod-pagespeed-beta-                      2/2 
Starting atd: [  OK  ]
job 1 at 2014-03-04 10:16
  Verifying  : at-3.1.10-43.el6_2.1.x86_64                                  1/2 
  Verifying  : mod-pagespeed-beta-                      2/2 

  mod-pagespeed-beta.x86_64 0:                                     

Dependency Installed:
  at.x86_64 0:3.1.10-43.el6_2.1                                                 


Nice. Now restart Apache for the changes to take effect:

service httpd restart

Thanks to Rahul Kumar for explaining this procedure here:

Verify that mod_pagewrite is working

The easiest way to do this is not from a web browser but from the command line. We’ll load a website and inspect the header information:

curl -D- | head -10

TP/1.1 200 OK
Server: nginx
Date: Tue, 04 Mar 2014 14:20:41 GMT
Content-Type: text/html; charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
Vary: Cookie,Accept-Encoding

The last line tells us that mod_pagespeed was indeed involved and is working fine. Needless to say, please replace with the website you’d like to test.

Managing mod_pagespeed

If yo’d like to turn the module off or on again, and you’re using Plesk, it’s as simple as (un-)ticking a box: head over to Tools and Settings (or Server if you’re using Power User View), click Apache Modules and find two new modules in the large list:

  • pagespeed (ticked after installation)
  • pagespeed_ap24

Screen Shot 2014-03-04 at 09.37.58

The latter is for Apache 2.4 which will only start if you actually have Apache 2.4 installed. If you’re running Apache 2.2 then the first module is for you and you’ll receive an error message should you try to start the other one.

If you are not using Plesk, or you prefer a more “bare bones command line” approach you can tweak the mod_pagespeed configuration file which lives in /etc/httpd/conf.d/pagespeed.conf:

vi /etc/httpd/conf.d/pagespeed.conf

<IfModule pagespeed_module>
    # Turn on mod_pagespeed. To completely disable mod_pagespeed, you
    # can set this to "off".
    ModPagespeed on


Simply change that line to ModPagespeed off, save the file and restart Apache.

Removing mod_pagespeed

To remove the module completely, erase the package and remove the extra yum source:

yum erase mod-pagespeed
rm /etc/yum.repos.d/google-mode-pagespeed.repo

It’s like it never happened ;-)

Further Reading

Jay is founder of WP Hosting, a boutique style managed WordPress hosting and support service. He has been working with Plesk since version 9 and is a qualified Parallels Automation Professional. In his spare time he likes to develop iOS apps and WordPress plugins, or drawing on tablet devices. He blogs about his coding journey at and

You can leave a comment on my original post.