What is mod_pagespeed and how to enable it?

Posted on December 7th, 2017

What is mod_pagespeed and how to enable it?


PageSpeed (mod_pagespeed) is a module for OpenLiteSpeed webserver, to speed up our websites on the server. PageSpeed module will speed up your websites by applying filters to files in order to reduce the number of requests from browsers to our server. It also reduces the size of the files and for optimizing the requests the files will be cached. The only downside of PageSpeed module is that sometimes it uses much more resources on servers. Let’s discuss some of the benefits of PageSpeed modules in short:

1) Minifies or compress external CSS and JavaScript.

2) It also combines multiple external JS files into one JS file to reduce the http requests.

3) Optimizes the cache for the files.

4) Uses the idea of URL fingerprinting for the new JS files.

5) Minifies the HTML.


As we mentioned on benefits this module will combines multiple JavaScripts into one file, this file will be stored in somewhere temporarily. The PageSpeed module will tells browser to store the JavaScript file for a long time.

Let’s discuss about the installation of PageSpeed module on cPanel server:

1) Download and install OpenLiteSpeed 1.4.2 or higher if you do not have on your server because PageSpeed module is available from OpenLiteSpeed 1.4.2

If you already have OpenLiteSpeed 1.4.2 or higher, first you need to go PageSpeed Module directory by login to your server via SSH as root user and then execute below commands.

# cd /openlitespeed_download/src/modules/pagespeed

# ./dlpsol.sh

This will install latest PageSpeed Optimization Libraries(PSOL) supported by OpenLiteSpeed. Then we need to build the modpagespeed.so by executing below command.

# make

If it throws any error while compiling try “gmake” instead of “make” then move this dynamic module (modpagespeed.so) to LightSpeed’s module directory.

# cp modpagespeed.so /usr/local/lsws/modules

2) Then we need to set up PageSpeed module via WebAdmin Console, we need to add the PageSpeed module at “WebAdmin console > Configuration > Server > Modules > Add”. Enter the module name as “modpagespeed” and default filter sets with below parameters and save the module settings. After making necessary changes restart lightspeed webserver from console or via terminal.

pagespeed on

pagespeed FileCachePath /tmp/lshttpd/pagespeed

pagespeed RewriteLevel CoreFilters

The PageSpeed module can be further configured at virtualhost level which will always override the server level-configurations.

3) Instead of performing step-2, we can also edit the configuration file of OpenLiteSpeed via command line and insert below codes to “httpd_config.conf” file.

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 http://ref.pssdemos.com/

#pagespeed RunExperiment on

#pagespeed EnableFilters inline_images

#pagespeed LoadFromFile /usr/lsws/lsws/admin/html/

#pagespeed LoadFromFile /usr/local/lsws/Example/html/




If you need any further help, please reach our support department.

Leave a Reply