Install OpenLiteSpeed with DirectAdmin

How Can We Help?
< Back
You are here:

How DirectAdmin Supports OpenLiteSpeed

Generally speaking, OpenLiteSpeed supports its native virtual hosts only. Unlike LiteSpeed Enterprise, OLS cannot read Apache virtual host configurations. Most of the popular control panels, including DirectAdmin, are based on Apache virtual host configuration, and as such they do not support OpenLiteSpeed by default.

However, DirectAdmin developers made an effort in 2019 to integrate OLS into their existing control panel environment through Custom Build 2. CB2 converts all existing Apache configurations to OLS native server and virtual host configurations, enabling you to easily upgrade from Apache to OpenLiteSpeed on DirectAdmin, with no tedious one-by-one virtual host re-creation. As a result, DirectAdmin users can now enjoy the lighting-fast performance LiteSpeed can bring, for free with OpenLiteSpeed.


  • DirectAdmin v1.57 or higher, or any pre-release binary
  • CustomBuild 2.0. Not sure which version of CustomBuild you’re using? See this guide and upgrade if necessary.

Install OpenLiteSpeed

To install OpenLiteSpeed, run the following commands from the /usr/local/directadmin/custombuild/ directory:

./build set webserver openlitespeed
./build set php1_mode lsphp
./build openlitespeed
./build php
./build rewrite_confs

If you have more than one version of PHP enabled, then you can add additional phpN_mode commands, like so:

./build set webserver openlitespeed
./build set php1_mode lsphp
./build set php2_mode lsphp
./build set php3_mode lsphp
./build openlitespeed
./build php
./build rewrite_confs

Edit PHP Settings

Since OpenLiteSpeed does not support Apache configuration via .htaccess files, you will need to make any changes to your PHP settings in the .user.ini file. For example, to change the memory_limit, the syntax looks like this:


Automatically Reload OpenLiteSpeed

Currently OpenLiteSpeed reads .htaccess files on startup. So, if some new .htaccess files are created while OLS is running, or existing files are modified, the changes don’t go into effect until OpenLiteSpeed restarts.

Please note that DirectAdmin provides customers an ability to reload OpenLiteSpeed directly from the user level, and does this automatically when .htaccess files are edited in the File Manager.

Using PureFTPd

If Pure-FTPd is in use, it will reload OpenLiteSpeed if the filename is .htaccess. To activate this behavior, run the following commands:

cd /usr/local/directadmin/custombuild
./build set pureftpd_uploadscan yes
./build pureftpd

Note: As of today, only Pure-FTPd supports this.

Using the Cron

If you would like to have a cronjob set up to restart OpenLiteSpeed when necessary, create one like the following. This example checks every three minutes for .htaccess files that were created since OpenLiteSpeed last reloaded. If it finds them, it reloads OpenLiteSpeed. Otherwise, it does nothing:

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

You can add the above line to /etc/cron.d/openlitespeed_htaccess_scan. (Adjust the */3 higher or lower to check more or less frequently.) It will scan for .htaccess files in the public_html and private_html folders, with a maximum depth of 2 folders. Max depth can be changed to 3 or more, or even made unlimited, but that could potentially slow down scanning.

Upgrade OpenLiteSpeed

In DirectAdmin, OpenLiteSpeed’s configuration is automatically generated by a DirectAdmin CustomBuild script during the installation. As such, you should NEVER use a package management command such as yum update openlitespeed or apt-get upgrade openlitespeed to upgrade OpenLiteSpeed. Instead, you should always use DirectAdmin’s CustomBuild script to perform any upgrade. The following command will upgrade OLS to the latest version:

./build update
./build openlitespeed

If you have any need to upgrade or downgrade OLS to a particular version, please refer to these DirectAdmin instructions. In this example, we are installing OLS v1.7.19:

cd /usr/local/directadmin/custombuild
echo "openlitespeed:1.7.19:" > custom_versions.txt
./build openlitespeed

Getting Support

Although OpenLiteSpeed is developed by LiteSpeed Technologies, the integration of OLS with DirectAdmin is handled by DA developers.  Generally speaking, DirectAdmin support has a better understanding of the integration process and the location of various OLS configuration files.

It’s probably a good idea to log a ticket with DirectAdmin support first. They will bring LiteSpeed support into the discussion if necessary. OLS developers work very closely with DA to fix any identified bugs and add requested features expediently.

See also

DirectAdmin’s Guide to OpenLiteSpeed