From OpenLiteSpeed Wiki

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 greater. Module support was made available in version 1.3 but the PageSpeed module is only available and supported as of version 1.4.2. The PageSpeed module is not added to OpenLiteSpeed installations automatically and must be built or installed through rpm/deb packages (OpenLiteSpeed 1.4.13 or greater).

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

Installing The LiteSpeed PageSpeed Module

Building The LiteSpeed PageSpeed Module

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

The PageSpeed Module is available as of OpenLiteSpeed version 1.4.2.

Add PageSpeed Optimization Libraries

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

Go into the PageSpeed Module directory /openlitespeed_download/src/modules/pagespeed and run ./ (or ./ for earlier PageSpeed versions) to get the latest version of PSOL supported by OpenLiteSpeed. Do not use other versions of PSOL as they may not be supported. (The currently supported version of PSOL can be found in our release log.)

cd /openlitespeed_download/src/modules/pagespeed



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

Move The Dynamic Library To The Modules Directory

cp /usr/local/lsws/modules

Install The LiteSpeed PageSpeed Module Through RPM/DEB Packages

With Redhat/CentOS/Debian/Ubuntu, you can install PageSpeed through LiteSpeed repos.

Enable the LiteSpeed repository(refer to LiteSpeed wiki) and run the following command:

 Redhat/CentOS:     yum install pagespeed
 Debian/Ubuntu:     apt-get install ols-pagespeed

This rpm will install to /usr/local/lsws/modules/ and optionally a sample PageSpeed config file, "modpagespeed.conf", to /usr/local/lsws/conf/.

Setting Up The PageSpeed Module

Setting up the module from WebAdmin Console

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

PageSpeed Mod Add.png

Enter "modpagespeed" as the module name

PageSpeed Mod Name.png

Set parameters with google default filter sets

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
PageSpeed Mod Param.png

Or you can use the configuration parameters covered in the "modpagespeed.conf" file(if existing) located in /usr/local/lsws/conf.

Save the module settings

PageSpeed Mod Save.png

Restart the server

Setting up module from httpd_config.conf

Instead of adding the PageSpeed module from the WebAdmin Console, you can also edit OpenliteSpeed's conf file directly from the command line and append the following content to "httpd_config.conf". The content may be included in the optional "modpagespeed.conf" file(if existing).

module modpagespeed {
param <<<END_param
pagespeed on
pagespeed InPlaceResourceOptimization off
pagespeed FetchHttps enable
pagespeed FileCachePath /tmp/lshttpd/pagespeed/
pagespeed EnableFilters remove_comments
pagespeed EnableFilters local_storage_cache
pagespeed EnableFilters extend_cache_pdfs
pagespeed EnableFilters combine_css
pagespeed EnableFilters rewrite_css
pagespeed EnableFilters extend_cache,rewrite_images
pagespeed EnableFilters rewrite_javascript
#pagespeed FileCacheSizeKb 102400
#pagespeed FileCacheCleanIntervalMs 3600000
#pagespeed FileCacheInodeLimit 500000000
pagespeed FetcherTimeoutMs 5000
#pagespeed ModifyCachingHeaders off
#pagespeed MapProxyDomain
#pagespeed RunExperiment on
#pagespeed EnableFilters inline_images
#pagespeed LoadFromFile /usr/lsws/lsws/admin/html/
#pagespeed LoadFromFile /usr/local/lsws/Example/html/


Configuration of OpenLiteSpeed's PageSpeed Module follows the syntax outlined in Google's documentation for the NGINX module.

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.