General

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:

da build set webserver openlitespeed
da build set php1_mode lsphp
da build openlitespeed
da build php
da build rewrite_confs

If you have more than 1 version of PHP enabled, then the list of commands will look like thes (the example for 3 versions of PHP installed):

da build set webserver openlitespeed
da build set php1_mode lsphp
da build set php2_mode lsphp
da build set php3_mode lsphp
da build openlitespeed
da build php
da build rewrite_confs

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

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:

da build set pureftpd_uploadscan yes
da build pureftpd

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

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: