Google PageSpeed Module

PageSpeed speeds up your site and reduces page load time. This open-source webserver module automatically applies web performance best practices to pages and associated assets (CSS, JavaScript, images) without requiring that you modify your existing content or workflow. Features:

  • Image Optimization (Compression and Resizing)
  • CSS & JavaScript Concatenation, Minification, and Inlining
  • Asset Caching
  • Deferred Loading of JavaScript and Images
  • Removal of HTML Comments and Whitespace
  • Lazy-loading Images (only loaded when they become visible in the viewport)

Supported platforms

  • CentOS/Fedora (32-bit and 64-bit)
  • Debian/Ubuntu (32-bit and 64-bit)
  • Apache 2.2 and greater


If you get the warning: httpd >= 2.2 is needed by mod-pagespeed-* and you do have the required version installed your installation of Apache httpd is¬†probably not from the system’s package manager. So the mod_pagespeed RPM package won’t work for your system without some work. It will install mod_pagespeed into the wrong location.

So the warning you are getting is perhaps not giving you all the information it could, but it’s helping to prevent you from installing mod_pagespeed on your system where it wouldn’t otherwise work. When you have an Apache httpd install that isn’t package-managed, the easiest way to install mod_pagespeed is to compile it yourself from source.

The mod_pagespeed packages install two versions of the mod_pagespeed code itself, for Apache 2.2 and for Apache 2.4. By default PageSpeed installs itself for the entire server including all VirtualHosts (Apache) or server blocks (Nginx). Created files during installation:

  • pagespeed.conf (/etc/apache2/mods-available or /etc/httpd/conf.d)
  • pagespeed_libraries.conf (/etc/apache2/conf.d)
  • pagespeed.load (Debian only /etc/apache2/conf.d)
  • mod_pagespeed cron script for checking and installing latest updates (/etc/cron.daily/mod-pagespeed)
  • /var/cache/mod_pagespeed (must exist and be writable by the apache user)

When you get error like ‘403 Forbidden when accessing pagespeed pagespeed_console and mod_pagespeed_statistics’¬† you have to add your ip address like:

<Location /mod_pagespeed_statistics>
    Order allow,deny
    # You may insert other "Allow from" lines to add hosts you want to allow to look at generated statistics.
    Allow from localhost
    Allow from
    SetHandler mod_pagespeed_statistics

When developing web pages with PageSpeed enabled, it is sometimes convenient to flush the cache of a running server, in order to get the system to reload CSS or JavaScript files that have been updated before the origin cache lifetime expires.

touch /var/cache/mod_pagespeed/cache.flush


CentOS / Fedora
sudo yum install at  # if you do not already have 'at' installed
sudo rpm -U mod-pagespeed-stable_current_x86_64.rpm

Debian / ubuntu
sudo dpkg -i mod-pagespeed-stable_current_amd64.deb
sudo apt-get -f install

Basic Settings

ModPagespeed on / off # Turn the module on or off

Leave a Reply