Modules:PageSpeed
From OpenLiteSpeed Wiki
Revision as of 21:20, 22 December 2014 by Marmstrong (talk | contribs) (→Building the LiteSpeed PageSpeed module)
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.
Add PSOL
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 ./ccc.sh
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. (The current version of PSOL supported by OpenLiteSpeed is listed in our Release_Log.)
cd /openlitespeed_download/src/modules/pagespeed ./ccc.sh
Build modpagespeed.so
make
Note: If compiling does not work, try gmake
instead of make
.
Move the dynamic library to your modules directory
cp modpagespeed.so /usr/local/lsws/modules
Setting up the module
Add the PageSpeed Module by going to WebAdmin console > Configuration > Server > Modules > Add
Enter the name of the module as "modpagespeed"
Set parameters
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
Restart the server
Configuration
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.
Note
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.