Install OpenLiteSpeed with DirectAdmin

As of DirectAdmin 1.57 and running CustomBuild 2.0, you can now install OpenLiteSpeed. OpenLiteSpeed is the Open Source edition of LiteSpeed Web Server Enterprise. OpenLiteSpeed contains all of the essential features found in LiteSpeed Enterprise, including full use of the LiteSpeed Cache (LSCache) for the WordPress plugin. It is developed and maintained by the same LiteSpeed development team.

Using OpenLiteSpeed provides your server with less overhead with all processes being Event-driven, is fully mod_rewrite compatible, with no new syntax to learn and you can continue to use your existing rewrite rules. Features include Anti-DDoS connection and bandwidth throttling, ModSecurity v3 integration, Built-in full-page cache module, Automatic implementation of Google’s PageSpeed with mod_pagespeed. You can find out more about OpenLiteSpeed’s features here.

OpenLiteSpeed although lacks the automatic reloading of OpenLiteSpeed when editing the .htaccess file. However, we will cover that off at the bottom of this guide. When used with DirectAdmin you will not have the ability to manage OpenLiteSpeed through the WebAdmin GUI as it is setup in read-only mode. You will have to configure OpenLiteSpeed using custom templates.

Install OpenLiteSpeed

You can install OpenLiteSpeed by changing the WEB Server Settings in DirectAdmin’s options.conf file or run the following commands:

cd /usr/local/directadmin/custombuild
./build update
./build set webserver openlitespeed
./build set mod_ruid2 no
./build set php1_mode lsphp
./build set php1_release 7.2
./build openlitespeed
./build php n
./build rewrite_confs

If you want to install more than one PHP version such as 7.1, 7.2, 7.3, and 7.4, you can use the following commands:

cd /usr/local/directadmin/custombuild
./build update
./build set webserver openlitespeed
./build set mod_ruid2 no
./build set php1_mode lsphp
./build set php1_release 7.1
./build set php2_mode lsphp
./build set php2_release 7.2
./build set php3_mode lsphp
./build set php3_release 7.3
./build set php4_mode lsphp
./build set php4_release 7.4
./build openlitespeed
./build php n
./build rewrite_confs

Check Installation

Now to check to make sure OpenLiteSpeed installed correctly, open your favorite browser and enter your server’s IP address or FQDN ( in the address bar. Once connected you should see the message OpenLiteSpeed is functioning normally in the top left of the screen. If you don’t receive this message please check the settings above and reinstall OpenLiteSpeed.

Automatically Reload mod_rewrite Rules

OpenLiteSpeed will only load mod_rewrite rules from .htaccess at startup only. To get around this you will need to add a cron task to reload OpenLiteSpeed automatically. By using the cron script below every time you edit a .htaccess file DirectAdmin will reload OpenLiteSpeed automatically so the new rewrite rules can take effect immediately.

echo '*/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' > /etc/cron.d/openlitespeed_htaccess_scan

The cron task will scan for .htaccess files in public/private_html folders, using a max depth of 2 folders -maxdepth 2. The folder depth can be changed to 3 or more by changing the
-maxdepth code to 3. Please note this will slow down scanning and could impact server performance.

You can check to ensure the file has been created by using the following command:

cat /etc/cron.d/openlitespeed_htaccess_scan

That’s it. You have now installed successfully install OpenLiteSpeed with DirectAdmin on your server. Checked the installation to ensure everything is working as it should and enabled the automatic reload of OpenLiteSpeed to ensure any mod_rewrite rules changes in your .htaccess file takes effect immediately.

  • 1 Users Found This Useful
Was this answer helpful?

Related Articles

How to reinstall DirectAdmin in your web server?

Run the following commands to install: cd /usr/local/directadmin./directadmin i./directadmin p

How to install imagick with custombuild of DA?

Run the following command: cd /usr/local/directadmin/custombuild ./build update ./build...

The service ‘exim’ on server xxx is currently down

Rebuild your exim. cd /usr/local/directadmin/custombuild./build update./build set exim...

Change DA port to your choice where CSF installed

Here I will show you how to change the port from 2222 to 9999 in two steps. Step One:...

How to migrate cPanel account to DirectAdmin?

The cPanel conversion script currently only works for Admin Level restores. You must have to be...