Modules¶
Register a Module¶
These steps should allow you to add any module you wish, though the configuration may vary from module to module. For this guide, we assume you already have downloaded a copy of the module source code and have a working installation of OpenLiteSpeed 1.3 or higher. Module support is only available in versions 1.3 or higher.
Make the Module¶
Source code for modules provided by LiteSpeed is located in the decompressed OpenLiteSpeed download package (not in your OpenLiteSpeed installation) under the src/modules
directory.
To make a module, cd
to the module's directory, and run the make
command. Copy the resulting dynamic library file to the OLS modules
directory.
Example
To make the example
module, run the following:
cd /openlitespeed_download/src/modules/example
make
example.so
. Copy example.so
to the OpenLiteSpeed modules
directory: cp example.so /usr/local/lsws/modules
Add the Module to OpenLiteSpeed¶
In the WebAdmin Console, navigate to Server Configuration > Modules.
Press the Add button.
Set Module to the name of the module. In this example, it's cache
.
Tip
The cache
module is already installed by default, so in the real world, you would not need to run these steps for cache
. Use this process on other modules that are not preinstalled.
Copy the module's parameters into the Module Parameters setting. You should be able to find these in the module's documentation. For this example, we've used the following parameters:
enableCache 0
enablePrivateCache 0
checkPublicCache 1
checkPrivateCache 1
qsCache 1
reqCookieCache 1
ignoreReqCacheCtrl 1
ignoreRespCacheCtrl 0
respCookieCache ``
expirelnSeconds 3600
privateExpirelnSeconds 3600
maxStaleAge 200
maxCacheObjSize 10000000
storagepath cachedata
noCacheDomain
noCacheUrl
no-vary 0
addEtag |0
Save the module settings, and Graceful Restart your server.
Make sure the module priority does not conflict with other modules. Conflicting module priorities can cause erratic functionality. Leaving priorities as Not Set
should be safe for most use cases.
Further Configuration¶
Modules may be able to be further configured at the virtual host, context, and script handler levels. More specific levels of configuration will always override more general levels. For example, virtual host-level configurations override server-level configurations and context-level configurations override virtual host-level configurations.
Develop a Module¶
OpenLiteSpeed encourages third party C/C++ developers to write their own OLS modules. A complete guide to developing modules for OpenLiteSpeed can be found in the /doc
directory of the source code package.
Or, Click here to view the OpenLiteSpeed Module Developer Guide PDF on GitHub.