PageSpeed Module

How Can We Help?
< Back
You are here:

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. We made module support available in version 1.3. However, you must be running v 1.4.2 or greater to use the PageSpeed module. Additionally, 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: Linux is the only OS to support PageSpeed Optimization Libraries (PSOL) and thus OpenLiteSpeed’s only makes a PageSpeed Module for Linux.

Installing The LiteSpeed PageSpeed Module

Install The LiteSpeed PageSpeed Module Through RPM/DEB Packages

Redhat/CentOS/Debian/Ubuntu have included PageSpeed mode in the latest rpm/deb packages, and you can install openlitespeed through LiteSpeed repos.

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


yum install ols-pagespeed


apt-get install ols-pagespeed

This rpm will install to /usr/local/lsws/modules/.

Setting Up The PageSpeed Module

You have choices for how to set up the module. You can set it up either through webadmin console, or you can append the configuration to the OLS main conf. Additionally, you can use “include /usr/local/lsws/conf/modpagespeed.conf” in the OLS main conf file if modpagespeed.conf exists.

Setting up the module from WebAdmin Console

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

Enter modpagespeed as the module name


Set parameters with google default filter sets. You can configure PageSpeed using a variety of settings and filters. The following are some default parameters:

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

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.

Restart the server.

Setting up module from httpd_config.conf directly

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/

Setting up module from httpd_config.conf through “include”

Instead of appending all configurations directly to httpd_config.conf, you may use “include” in the httpd_config.conf

Also, if the above modpagespeed.conf exists, you can add the following line to httpd_config.conf:

include /usr/local/lsws/conf/modpagespeed.conf 


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

Important Parameters

    • pagespeed on/pagespeed 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: The Google PageSpeed team believes the dynamically-updated CoreFilters set is safe for most websites.

Further configure the module at the virtual host level

You can further configure the PageSpeed Module at the virtual host level. (Google does not support context- and script handler-level configurations.) Also, 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.


Build The LiteSpeed PageSpeed Module if you install openlitespeed from source

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