Google’s new PageSpeed Apache Module is incredible. The number of options available to improve performance on the assets served from your web server will blow your mind. I found that the default configuration worked well, but I did decide to add a few options that weren’t part of their “core set”.

I did however hit a few snags in the installation and configuration of the module. Nothing serious, but I thought it was worth pointing them out, in case others run into the same problems.

Installation

> yum install at

Package at-… already installed and latest version

Nothing to do

This is okay, it just means that at is already installed.


> rpm -U mod-pagespeed-*.rpm

error: File not found by glob: mod-pagespeed-*.rpm

 

The error occurs because the -U option means upgrade. I’m not sure why Google suggests using this option in their installation docs.

The approach that works is:

> rpm -i mod-pagespeed-*.rpm

If it works, great. If not, you might get an error like this:

error: File not found by glob: mod-pagespeed-*.rpm

In this case, try installing with yum. You’ll need to setup the correct repositories first. This post has detail on setting up the repos, then installing with yum.

 

Configuration

At this point, if you’ve installed an Apache module before, you assume that you need to head over to your httpd.conf file and add this line:

LoadModule pagespeed_module modules/mod_pagespeed.so

Not true!

The PageSpeed Module has already been added to Apache’s config, even though you don’t see a LoadModule directive.

The installation process actually created a new configuration file in your server’s conf.d directory. This file is called pagespeed.conf.

The installation actually assumes that your httpd.conf has the following directive in place:

Include conf.d/*.conf

Apache comes standard with this directive in place, but some admins and hosts remove this line for security reasons (so any script or unauthorized person can’t just place a conf file in the conf.d folder). So, keep this in mind if the module does not load automatically for you.
Oh, once your done configuring, don’t forget to restart apache!

 

Tips

  1. You may find that PageSpeed’s server-side caching is a little to strong when you are in development mode on a website. Luckily, you can turn off page speed on an individual virtual host basis, i.e.:<VirtualHost *:80>
    ServerName dev.mysite.com
    DocumentRoot /var/www/html/mysite_com/dev

    ModPagespeed Off

    </VirtualHost>

  2. If you need to make a quick change to a site that has mod_pagespeed enabled, just append
    ?ModPagespeed=off

    to the URL. This query string parameter will cause mod_pagespeed to disable itself.

Tags:

1 Comment

Leave a Reply

Your email address will not be published. Required fields are marked *