This guide will teach you how to convert a DirectAdmin shared-hosting server to an optimized high-performance DirectAdmin + LiteSpeed Enterprise Web Server.
You will learn how to best utilize LiteSpeed Web Server, LiteSpeed Cache, and LiteSpeed Cache Manager for DirectAdmin. The steps outlined in the guide are just that: outlines. They should be used in conjunction with the more detailed materials in the links provided. In other words, if a section of this guide is not perfectly clear, but there is a link attached to that section, please check the link. There are many things that are too complicated to be explained fully in this short document.
LiteSpeed provides one-stop web-acceleration solutions that embrace and advance cutting-edge technologies. Products include LiteSpeed Web Server, LiteSpeed Web ADC load balancer, cache solutions, and OpenLiteSpeed open source web server, among others.
LiteSpeed Web Server¶
LiteSpeed Web Server offers a combination of cutting-edge features, outstanding scalability, best-in-class performance, Apache compatibility and application-level cache acceleration.
LiteSpeed Web Server with DirectAdmin and CustomBuild¶
LiteSpeed Web Server is a drop-in replacement for Apache which provides high performance with LSCache solutions, and uses many fewer resouces. This script uses DirectAdmin's CustomBuild Plugin to install LiteSpeed Web Server.
Prepare for the Installation¶
Obtain a License¶
Visit the LiteSpeed store to obtain a license.
You can get a Free Starter License if you are planning to host only a single domain and have a server with less than 2GB RAM. Other Licenses can also be purchased from the same link. If you are looking for a trial license and have a server with more than 2GB RAM and multiple domains, you can skip this step.
If you need help with choosing a License, visit our wiki.
Verify SSH and sudo Permission on Server¶
LiteSpeed Web Server requires you to have full root access to the server for the installation.
Remove any Previous Apache Replacements or Reverse Proxies¶
The CustomBuild Plugin will disable all the other Webservers(Apache/Nginx) installed on the server. If you have a custom setup, please manually uninstall any reverse proxies like Nginx over Apache or Nginx/Varnish before installing LiteSpeed Web Server.
Ensure all Websites are Working Well on Apache¶
Before installing LiteSpeed, you should make sure that your DirectAdmin installation is working fine with Apache. If this is a brand new server, you can add a test domain and remove it later.
Ensure that TCP 80,443 and UDP 443 are open in Firewall Configuration¶
In addition to TCP 80 and TCP 443, LiteSpeed uses UDP 443 for QUIC, which is one of the most popular features of LiteSpeed, and it and provides great benefits to your websites.
TCP 7080 is also used by LiteSpeed for its WebAdmin Console, and it requires a username and password to log in, which you will set during the installation. You should keep this port open to Administrative IP's only.
This method is recommended if you are installing LiteSpeed for the first time. We will discuss each and every option that is presented during the installation process in detail.
LiteSpeed installation is easy and straightforward. Log in to your SSH server and run the following command, replacing
your_serial_no with your License key:
bash <( curl https://get.litespeed.sh ) your_serial_no
This script detects your environment and downloads only the required dependencies and installation data from our servers. Depending on the environment, the script asks you for input to various questions. Finally, it installs LiteSpeed Web Server.
To use this script with a trial license, just replace
your_serial_no with the word
TRIAL (in all capitals), like so:
bash <( curl https://get.litespeed.sh ) TRIAL
Once you've started the script, it will detect that your installation is using DirectAdmin and will ask your input with the following prompts:
Could not find an lsws.options file¶
Could not find an lsws.options file. We will ask you for your preferred settings instead, but for automated bulk provisioning, you may want to exit and create an lsws.options file. Continue Installer(Y/N) ?
This is expected since this is the detailed installation process.
lsws.options is for quick/automatic installation.
Enter to proceed.
Default PHP version¶
php_version_default. Available options are - 7.2, 7.1, 7.0, 5.6.
This will be the first and default PHP version on your server.
Second PHP version¶
php_version_second. Available options are - 7.2, 7.1, 7.0, 5.6, no.
This will be the second PHP version on your server. Just enter
no(without caps) if you would like to not install a second PHP version.
Third PHP version¶
php_version_third Available options are - 7.2, 7.1, 7.0, 5.6, no.
This will be the thrid PHP version on your server. Just enter
no(without caps) if you would like to not install a second PHP version.
Fourth PHP version¶
php_version_fourth. Available options are - 7.2, 7.1, 7.0, 5.6, no.
This will be the fourth PHP version on your server. Just enter
no(without caps) if you would like to not install a second PHP version.
After all of the values have been entered, the script will install LiteSpeed Web Server on your DirectAdmin server.
Once the installation is complete, you should see the following success message with a randomly generated password. You should save this password in a safe place. You can also change it later.
If you encounter any problems during the installation, feel free to create a ticket with us, and we will be happy to help.
This method uses shortcuts to automate the installation and deployement of LiteSpeed in the fastest possible way on DirectAdmin servers.
In most situations, running the installer script manually is sufficient. However, it is possible to automate the process for bulk provisioning. To do this you can create a
lsws.options file and upload it to your organization's internal repo. This will allow the installer to pick up installation options directly from the file and will not ask for input from the user.
lsws.options file will looks like this:
php_version_default="7.2" php_version_second="7.1" php_version_third="no" php_version_fourth="no"
You can create
lsws.options and keep it on your local network for bulk provisioning, at a URL like
yourlink.com/yourinternalrepo/lsws.options and then run the following command:
curl -o lsws.options yourlink.com/yourinternalrepo/lsws.options && bash <( curl https://get.litespeed.sh ) your_serial_no
yourlink.com/yourinternalrepo/lsws.options is the link to your personalized lsws.options file which should be accessible to your servers.
lsws.options is the location of the lsws.options file. If you're running the installer from the same directory as your lsws.options file, Its fine to leave it exactly like that.
your_serial_no is the license key for LiteSpeed Web Server. You can also use
TRIAL if you want to request a Trial License. If you see an error while using the Trial license, Refer to the FAQ.
Verify is LiteSpeed Web Server is Running¶
Navigate to DirectAdmin's Service Manager to check if LSWS is running.
Set Up Cache Root and Enable LiteSpeed Cache Throughout the Server¶
Cache Storage Settings¶
Set Server-Level Cache Root¶
Add the following lines to the
<IfModule Litespeed> CacheRoot /home/lscache </IfModule>
It is recommended that you set the server-level cache root to
/home/lscache/ or a disk partition with enough space. Please never set cache root to
Set Virtual-Host-Level Cache Root for all Virtual Hosts¶
<IfModule Litespeed> CacheRoot lscache </IfModule>
This is done to set each Virtual Hosts' cache directory to its home directory (
Apply these changes to all Virtual Hosts by running the following command:
cd /usr/local/directadmin/custombuild ./build rewrite_confs
LiteSpeed Web Server will be restarted after running above commands.
Set up DirectAdmin LiteSpeed Plugin to manage Cache Installations¶
Download the DirectAdmin Plugin
.tgz file from here.
Log into the DirectAdmin Panel with the
admin username, or with a user which has admin-level authorizations. After you're logged in, navigate to the Plugin Manager section. It is usually located at
Click Add New.
Click Upload, and select the
.tgz file you downloaded. In the Password section, Enter your DirectAdmin user's password. Click Install.
Once the installation is complete, you should be see the Litespeed Webserver Plugin option listed among Extra Features.
Using the Plugin¶
From within the LSCWP Version Manager section, select the WordPress plugin version you'd like to install on all WordPress websites hosted on the server.
From the Manage Cache Installations section, click Scan to search the entire server for existing WordPress installations. You can also enable or disable cache for individual websites from here.
From the Mass Enable/Disable Cache section, you can Enable or Disable Cache on all scanned WordPress installations throughout the server. This is safe because it automatically skips the WordPress installations which have a different cache plugin installed.
This plugin can also be used to access the Litespeed WebAdmin Console to manage license-based functions.
Set up ModSecurity Rules for LiteSpeed with DirectAdmin¶
By default, DirectAdmin CustomBuild can install OWASP rulesets without a third party installation script. You can run the following commands to enable ModSecurity and install OWASP rules automatically:
cd /usr/local/directadmin/custombuild ./build set modsecurity yes ./build set modsecurity_ruleset owasp ./build modsecurity
If you prefer Comodo WAF, DA CustomBuild may call the Comodo client agent script to install the rule set, but you run a risk of installing the Apache ruleset instead of the LiteSpeed ruleset. (The two servers have different rulesets for Comodo WAF.) In order to avoid installing the wrong ruleset, we recommend following the Comodo WAF Quick Start Guide instead of using CustomBuild for this.
Verify LiteSpeed is Running Correctly on Websites and LiteSpeed Cache is Working¶
Now that the installation and enablement process for your server has been completed, it's time to verify that your websites are running on LiteSpeed and that LiteSpeed Cache is working correctly on your WordPress websites.
Select User Level and Click Domain Setup and open any customer’s website, and check its headers, like so:
The headers should show Server as
LiteSpeed and X-LiteSpeed-Cache as
The X-LiteSpeed Cache header will only be shown on Websites which have LiteSpeed Cache enabled at that moment. Other websites will show Server as
LiteSpeed only, and will continue to use benefits provided by LiteSpeed without caching.
Headers can be checked by using browser extensions.
Set Up Default PHP Version¶
When DirectAdmin sets up an Apache virtual host, it does not set a PHP handler version, and Apache uses
php1 by default in the absence of a specified PHP version. LiteSpeed, on the other hand, does not use
php1 as the default PHP version when there is no PHP version specified. You will need to set up a default PHP version for LiteSpeed through the LiteSpeed WebAdmin Console.
Log into LSWS WebAdmin Console, navigate to Configuration > Server > PHP, and set Default PHP Versions to
xx is the PHP version you wish to use.
php74 for PHP v7.4
Default PHP Versions is a generic PHP handler customization, and is not specific to DirectAdmin. It applies to all control panels and to standalone installation. cPanel or Plesk may override the default through Apache
httpd.conf, but DirectAdmin relies only on this setting, as it has no PHP handler override for Apache.
Set Up Multiple PHP Versions¶
DirectAdmin CustomBuild allows multiple PHP versions when you build PHP. In
/usr/local/directadmin/custombuild/options.conf, you can build four diferent php versions using
php4_release. Once they have been built, any type of handler, such as lsphp, php-fpm, fastcgi, etc., will be stored in
php1_release will be the default PHP version unless it is overridden by the
In the DirectAdmin Control Panel, you can choose a domain's PHP version from the list in the DA PHP Selector at the domain level configuration.
Select User Level, click Domain Setup, and select any website from the list. Head over to the PHP Version Selector option and select the desired PHP Version. Press the Save button.
After a PHP version such as
php72 is selected, DirectAdmin will write the handler configuration to the domain's virtual host Apache confgiguration, like so:
How to Use CloudLinux PHP Selector with DirectAdmin¶
When you install CloudLinux and CloudLinux PHP Selector to Direct Admin, both CloudLinux PHP Selector and DA PHP Selector will take effect. CloudLinux PHP selector is per-user, while DA PHP Selector is per-domain. DA PHP Selector always overrides PHP version at the domain level. If you don't use DA PHP Selector on a domain, then CloudLinux PHP Selector is in effect.
If you, as a user, select
php73 in Cloud Linux PHP Selector, you may still select
php56 for one or more domains under your user account.
The CloudLinux PHP Selector interface can be found at the user level after login, under Advanced Features > Select PHP Version.
According to DirectAdmin documentation, if you're running CloudLinux and have
php1_mode=lsphp, you'll be able to use the CloudLinux PHP Selector plugin.
If you also use the DirectAdmin PHP selector, the CloudLinux selection only takes effect if the domain is using the first DA PHP instance.
CloudLinux documentation notes: to prevent DirectAdmin PHP Selector from interfering with CloudLinux PHP Selector, you need to have only one PHP version built on the server with CustomBuild.
While the linked documentation above deals with Apache, LiteSpeed Web Server will work the same way.
In any case, if there is any interference between CloudLinux PHP Selector and DirectAdmin PHP Selector, and you cannot work out the correct overriding logic between DA and CL, you can simply force LiteSpeed to use the CloudLinux PHP Selector by adding the following to .htaccess
<IfModule LiteSpeed> AddHandler application/x-httpd-phpsel .php </IfModule>
More specifically, you can override to a particular
alt-php version such as
php74 by adding the following to .htaccess:
<IfModule LiteSpeed> AddHandler application/x-httpd-alt-php74 .php </IfModule>
Control HTTP/2 and HTTP/3 via Apache Config¶
You can enable and disable a variety of protocols including HTTP/3 and HTTP/2 in
httpd.conf, using the
SpdyEnabled directive, like so:
<IfModule LiteSpeed> SpdyEnabled http3 </IfModule>
Other valid parameters are
All protocols are enabled by default. As such, if you wish to use all SPDY, HTTP/2, and HTTP/3 protocols, there is no need for a
SpdyEnabled directive at all.
When you use this directive to explicitly enable one or more protocols, anything not selected will be disabled. For example,
SpdyEnabled http2 will enable HTTP/2, while SPDY and HTTP/3 will be disabled. Be careful not to inadvertantly disable a protocol you wanted to use!
Switch Between Apache and LiteSpeed¶
If you have a need to switch between Apache and LiteSpeed you may use the following commands:
Frequently Asked Questions¶
What if I see a failure message when I request a TRIAL license during installation?¶
We track all licenses by Server IP. If your server has been given a trial license before, it won't be able to request another automatically. We will, however, reset it by request for eligible servers. To request another trial, please contact us.
Will LiteSpeed automatically sync all of my current and new domains?¶
LiteSpeed is a full-service drop-in replacement for Apache on DirectAdmin servers. As a result, it will automatically pick up all of the domains hosted on your server. It will also work with any new domains without error.
Will LiteSpeed match all of my PHP installations?¶
LiteSpeed will install PHP according to the options selected during installation, or it will pick up options from the
lsws.options file in the installation directory, if available.
How do I troubleshoot errors with LiteSpeed Web Server?¶
If you see an error on your websites while using LiteSpeed, Please refer to the LiteSpeed Wiki
How do I change my WebAdmin Port?¶
Some services like Bitninja also use TCP 7080, which is LiteSpeed WebAdmin Console's default port. Without it, LiteSpeed will not start. If 7080 is assigned to another service, you can change WebAdmin's port like so: Open
/usr/local/lsws/admin/conf/admin_config.xml using your preferred editor. Change the value of Listener from
7080 to your desired available port.
How do I change the LiteSpeed WebAdmin Console Password?¶
You may change LiteSpeed's WebAdmin Console password, like so:
cd /usr/local/lsws/admin/misc ./admpass.sh
How do I add the LSCache plugin to WordPress websites?¶
Log in to the WordPress Dashboard and install the plugin directly from the Wordpress Plugin Directory
How do I install LiteSpeed Cache extensions on other CMS's?¶
LiteSpeed Cache supports various other CMS's, like Joomla and Drupal. Please visit our website for more information on the CMS'es supported by LiteSpeed, and for instructions for downloading and installing each.
How do I utilize LiteSpeed Cache on CMS's where no plugin exists?¶
Please check out our no-plugin setup guidelines on our wiki.
What happens if my LiteSpeed license Domain/RAM Limit is crossed? or if my license expires?¶
In a case where your LiteSpeed license is deemed invalid (due to exceeding limits or reaching the exiration date), your system will automatically switch to Apache. (This is true as of LSWS v5.3.5)
Which license should I choose?¶
Visit our website for a complete guide to choosing a license. Don't worry if you are not sure what level will be right for your needs. You can upgrade or downgrade your license at any time.
I want to use DirectAdmin with OpenLiteSpeed instead, How to do it?¶
DirectAdmin does support OpenLiteSpeed as well and can be installed using instructions here
Installation for LiteSpeed Web Server on DirectAdmin is done using DirectAdmin's CustomBuild Plugin. Please get in touch directly with DirectAdmin for any CustomBuild support-related queries. For any LiteSpeed-related queries, please get in touch with us at