Overview

OpenLiteSpeed is the Open Source edition of LiteSpeed Web Server Enterpriseopen in new window. OpenLiteSpeed contains all of the essential features found in LiteSpeed Enterprise, including LSCache (the Litespeed caching plugin needed for WordPress).

However, it has some limitations such as :

  • it supports only simple RewriteRules in .htaccess files
  • it requires a restart to apply changes to .htaccess or .user.ini files
  • it does not support Apache configuration (uses its own syntax)

How to install OpenLiteSpeed

To install OpenLiteSpeed, do the following:

./build update
./build set webserver openlitespeed
./build set mod_ruid2 no
./build set php1_mode lsphp
./build openlitespeed
./build php n
./build rewrite_confs
1
2
3
4
5
6
7

How to edit PHP settings with OLS

As said previously, OpenLiteSpeed does not support Apache configuration via .htaccess files, so if you need to change PHP settings like memory_limit, then you'll use .user.ini file with syntax like this:

memory_limit=128M
1

How to make OLS automatically reload after .htaccess changes

Currently OpenLiteSpeed reads .htaccess on startup, so, if some new .htaccess files are created, or existing ones modified, changes are not in effect until the reload of OpenLiteSpeed service.

Please note that DirectAdmin provides customers an ability to reload OpenLiteSpeed directly from the user level, and does this automatically for the .htaccess files edited in File Manager. Also, if Pure-FTPd is in use, it will also reload OpenLiteSpeed if the filename is .htaccess. To activate it:

cd /usr/local/directadmin/custombuild
./build update
./build set pureftpd_uploadscan yes
./build pureftpd
1
2
3
4

Note: As of today only Pure-FTPd supports it.

However, if you would like to have a cronjob set up, which would reload OpenLiteSpeed every X minutes if there are newer .htaccess files than the starting time of OpenLiteSpeed, you may use a cronjob like the following (where */3 means every 3 minutes, you may change it to happen less/more often):

*/3 * * * * root if ! find /home/*/domains/*/*_html/ -maxdepth 2 -type f -newer /usr/local/lsws/cgid -name '.htaccess' -exec false {} +; then /usr/local/lsws/bin/lswsctrl restart; fi
1

Cronjob can be created as /etc/cron.d/openlitespeed_htaccess_scan. It scans for .htaccess files in public/private_html folders, with a max depth of 2 folders (it can be changed to 3, or even unlimited, however, it could slow the scanning down).

Last Updated: 6/23/2021, 9:36:08 PM