Difference between revisions of "Modules:PageSpeed"

From OpenLiteSpeed Wiki

(Restart the server)
Line 57: Line 57:
=== Restart the server ===
=== Restart the server ===
== Test ==
== Test ==

Revision as of 21:00, 22 December 2014

This wiki discusses how to add and configure OpenLiteSpeed's PageSpeed module. The PageSpeed module allows OpenLiteSpeed to support Google's PageSpeed optimization system.

For this guide, we assume you already have a working installation of OpenLiteSpeed 1.4.2 or higher. Module support is available in versions 1.3 or higher, but the PageSpeed module is only available and supported starting with version 1.4.2. The PageSpeed module is not added to OpenLiteSpeed installations automatically and so must be built.

Note: PageSpeed Optimization Libraries (PSOL) are only available for Linux and thus OpenLiteSpeed's PageSpeed Module is only available for Linux.

Building the LiteSpeed PageSpeed module

Download OpenLiteSpeed 1.4.2 and install or higher if you have not done so

The PageSpeed Module is available starting with OpenLiteSpeed version 1.4.2.


The PageSpeed Optimization Libraries (PSOL) are a set of C++ classes that automatically optimize web pages.

Go into the PageSpeed Module's directory (/openlitespeed_download/src/modules/pagespeed) and run ./ to get the latest version of PSOL supported by OpenLiteSpeed. Do not use other versions of PSOL as they may not be supported by OpenLiteSpeed.

cd /openlitespeed_download/src/modules/pagespeed



Note: If compiling does not work, try gmake instead of make.

Move the dynamic library to your modules directory

cp /usr/local/lsws/modules

Setting up the module

Add the PageSpeed Module by going to WebAdmin console > Configuration > Server > Modules > Add

Error creating thumbnail: File missing

Enter the name of the module as "modpagespeed"

Error creating thumbnail: File missing

Set parameters

Error creating thumbnail: File missing

PageSpeed may be configured using a variety of settings and filters. The following are some default parameters:

pagespeed on
pagespeed FileCachePath /tmp/lshttpd/pagespeed
pagespeed RewriteLevel CoreFilters

Configuration is covered in more detail in the configuration section.

Save the module settings

Error creating thumbnail: File missing

Restart the server


Google offers test files to test your PageSpeed support.


Configuration of OpenLiteSpeed's PageSpeed Module follows the syntax outlined in Google's documentation for the NGINX module. The one difference is that lines should not end with a semicolon (;).

Important Parameters

  • pagespeed on/off = This parameter turns PageSpeed on or off at the server or virtual host level.
  • pagespeed FileCachePath = Determines the location of the PageSpeed cache. (If this directory does not exist, OpenLiteSpeed will create it.)
  • pagespeed RewriteLevel CoreFilters = CoreFilters is a set of filters that the Google PageSpeed team believes are safe for most websites. The CoreFilters set is dynamically updated.

Further configure the module at the virtual host level

The PageSpeed Module can be further configured at the virtual host level. (Google does not support context- and script handler-level configurations.) Virtual host-level configurations will always override server level-configurations.

Note: Always leave the Enable Hooks setting as "Not Set". Setting it to "No" will not disable PageSpeed at the virtual host level and may cause unpredictable functionality. To disable PageSpeed at the virtual host level, use pagespeed off in the virtual host-level module parameters.


Do not use with the PageSpeed Module with OpenLiteSpeed's Cache Module. PageSpeed has its own cache and using the two modules together may cause unpredictable functionality.