What is Mod PageSpeed? Installation and Configuration.

Last modified: July 31, 2020
You are here:
Estimated reading time: 2 min

PageSpeed (mod_pagespeed) is a module for OpenLiteSpeed web server, 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 module in short:

1) Minifies or compress external CSS and JavaScript.

2) It also combines multiple external JS files into one JS file to reduce 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 combine multiple JavaScripts into one file, this file will be stored in somewhere temporarily. The PageSpeed module will tell the browser to store the JavaScript file for a long time.

 

Let’s discuss 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 to PageSpeed Module directory by login to your server via SSH as root user at “/openlitespeed_download/src/modules/pagespeed” 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 an error while compiling try “gmake” instead of “make”.  Then move this dynamic module (modpagespeed.so) to Lite speed’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 LiteSpeed web server from the console or via terminal.

pagespeed on

pagespeed FileCachePath /tmp/lshttpd/pagespeed

pagespeed RewriteLevel CoreFilters

The PageSpeed module can be further configured at virtual host 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://127.0.0.1:8088/http://ref.pssdemos.com/

#pagespeed RunExperiment on

#pagespeed EnableFilters inline_images

#pagespeed LoadFromFile https://127.0.0.1:7080 /usr/lsws/lsws/admin/html/

#pagespeed LoadFromFile https://127.0.0.1:8088 /usr/local/lsws/Example/html/

END_param

}

 

If you have any additional questions or concerns, please contact [email protected]

 

Was this article helpful?
Dislike 0
Views: 11