Set the hostname
Before you install any package, ensure that your hostname is correct by completing the Setting Your Hostname section of the Getting Started guide. Issue the following commands to verify that hostname:
hostname hostname -f
Make sure your system is up to date using apt:
sudo apt-get update && apt-get upgrade
This ensures that all software is up to date and running the latest version.
Installing required packages
Pagespeed requires some extra packages, which you should install for proper operation. Do so by issuing the following command in the terminal:
sudo apt-get install build-essential zlib1g-dev libpcre3 libpcre3-dev unzip
If you’re on a 64-bit version (likely)...
If you’re on a 32-bit version (less likely)...
Follow up with:
yum install at
(If you do not already have 'at' installed)
rpm -U mod-pagespeed-*.rpm
Remove the downloaded package
The module enables itself automatically when installed. However, you must restart Apache for it to start working.
systemctl restart httpd
You should now have a working version of mod_pagespeed up and running on your VPS. You can check this by looking at your page’s response headers. There should be a value for “X-Mod-Pagespeed” with the version number you installed.
Turn mod_pagespeed On/Off
First off, you can turn the module on or off with the ModPagespeed setting.
You can specify different “levels” of settings to simplify any configuration. The default is
“CoreFilters.”It contains a set of filters the Google team believes is safe for use. The filters are the individual actions that are applied to a file. In general, you won’t need to change this value. It’s easier to use this default and then enable or disable filters using the
The default setting:
To disable CoreFilters use this setting:
Note: You’ll have to explicitly enable any filters you want to turn on using the “
Using the default “CoreFilters” rewrite level includes a number of filters by default. As of the time of this writing, it includes:?
New filters will be added in the future. By using CoreFilters, you’ll automatically have these filters enabled if they become part of the default set whenever you update mod_pagespeed. Using PassThrough will require you to explicitly enable the new filters.