cPanel

This guide will teach you how to convert a cPanel shared-hosting server to an optimized high-performance cPanel + LiteSpeed server.

It is an outline of features and issues to help you utilize LiteSpeed Web Server, LiteSpeed cache, LiteSpeed Cache Manager for cPanel, and LiteSpeed cache plugins as all-in-one solutions. 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.

Introduction

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.

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 cPanel/WHM

LiteSpeed Web server is a Drop-in Replacement for Apache but provide high performance with LSCache solutions and use much less resouces. LiteSpeed Web Server supports all Distros supported by cPanel and also supports Cloudlinux and CageFS out of the box.

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.

Disable mod_ruid2

LSWS is not compatible with mod_ruid2 because LSWS does not allow the process user to change mid-process. Make sure that mod_ruid2 is disabled in your WHM settings. LSWS is compatible with Apache prefork or event MPM, but if mod_ruid2 is enabled, a variety of functionality may be disrupted WHM creates files that the web server user cannot access.

Remove any Previous Apache Replacements or Reverse Proxies

Please uninstall any previous replacements like Nginx, 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 cPanel/WHM 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 login which you will set during the installation. You should keep this port open to Administrative IP's only.

Installation

There are two ways to install LiteSpeed Web Server on your system: Detailed installation, and quick/automated installation.

Detailed Installation

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.

Tip

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

This will automatically request a trial license for your server and install LiteSpeed Webserver on it. If you see an error while using the Trial License, Please refer to the FAQ.

Once you've started the script, it will detect that your installation is using cPanel/WHM 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.

Press Y and Enter to proceed.

Enable PHP_SUEXEC

Enable PHP_SUEXEC. Run PHP processes as the account owner. Available values: 0 (off), 1 (on), and 2 (user home directory only).

This option defines how a PHP process will run in your server. For Shared hosting servers, a value of 2 is recommended, and is the default.

Apache port offset

Apache port offset. Run LiteSpeed in parallel with Apache. For example, if set to 1000, Apache will listen on port 80, and LiteSpeed on 1080. If set to 0, Apache and LiteSpeed will use the same port, and LiteSpeed will not automatically start after installation.

This option defines the port to which LiteSpeed Web Server should bind once installed. It is recommended that you first set the port offset to something other than 0 (like the default value of 1000). This will allow LiteSpeed and Apache to run concurrently while you test if LiteSpeed works correctly on your server.

You can change the port offset to 0, after the installation is completed and you are confident that your websites are working properly with LiteSpeed.

If you choose to set port offset to 0 now, LiteSpeed will start after installation, and Apache will be stopped. This also requires that you enable the Switch to LiteSpeed Automatically option, which we will discuss below.

Admin username

Admin username. For accessing LiteSpeed WebAdmin console.

This option defines the username you will use to access the LiteSpeed WebAdmin Console, which is helpful for accessing LiteSpeed Stats or controlling LiteSpeed behavior after installation. It is recommended that you set this to something secure.

Default value is admin.

Admin email address

Admin email address. Receive important server notices, such as license expiration and server core dumps.

This option sets the email address at which you will recieve notices, warnings, and errors from LiteSpeed Webserver. It is recommended to set this to an email you regularly monitor.

Default value is root@localhost.

EasyApache integration

EasyApache integration. Automatically rebuild matching PHP for LiteSpeed under EasyApache 3. Does nothing under EasyApache 4. Available values are 1 (enable) and 0 (disable).

This option tells the installer to build a matching PHP for LiteSpeed. It is only useful if you're still using EasyApache3. EA3 has reached end of life, and this value has no effect on EasyApache 4.

Default value is 1.

Switch to LiteSpeed Web Server

Switch to LiteSpeed Web Server. Automatically switches at the end of the installation if the port offset is set to 0. Available values are 1 (enable) and 0 (disable).

This option defines if the installer should automatically shut down Apache and shift to LiteSpeed Web Server after installation. If you've set Apache Port Offset to 0 earlier, then you should set this to 1.

Default value is 0.

Deploy LSCWP Automatically

Deploy LSCWP Automatically. Scans for Wordpress Websites on server and installs LSCache Plugin on them, Automatically sets up Cache Root. Available values are 1 (enable) and 0 (disable).

This value controls the automatic deployement of LiteSpeed Cache on the server and on all the WordPress websites on the server. If enabled, It will automatically set up default cache roots at the server level and also at the virtual host level. Once installed, it will also scan for all WordPress websites on the server and will install LiteSpeed Cache Plugin on them.

Note

LiteSpeed will not install its Cache Plugin on websites which are already using a full page caching plugin. Those sites will be skipped.

After all of the values have been entered, the script will install LiteSpeed Web Server on your cPanel/WHM 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.

Quick/Automated Installation

This method uses shortcuts to automate the installation and deployement of LiteSpeed in the fastest possible way on cPanel/WHM 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.

A default lsws.options file will looks like this:

php_suexec="2"
port_offset="1000"
admin_user="admin"
admin_pass="a1234567"   
admin_email="root@localhost"
easyapache_integration="1"
auto_switch_to_lsws="0"
deploy_lscwp="0"

admin_pass is a new option here. It is the password which will be used to access your LiteSpeed WebAdmin Console. Set it to something secure for your internal usage only.

If you do not understand what the other options mean, please go through the detailed installation process once.

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

Note

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.

After Installation

Switch to LiteSpeed and Verify it is Running

Tip

This step is only needed, if your Apache Port Offset was set to anything other than 0, or Auto Switch to LSWS was set to 0. These are the situations in which LiteSpeed will be installed but will not be started or set as a default web server.

To verify, navigate to WHM > Plugins > LiteSpeed Web Server. This will confirm that LiteSpeed is running. However, if you see Apache is running instead, find the Switch to LiteSpeed option on that page and click it.

Alternately, you can switch to LSWS using the following SSH command:

/usr/local/lsws/admin/misc/cp_switch_ws.sh lsws

You can replace lsws in the above command to apache if you want to switch back to Apache.

Warning

It is not recommended to switch using running commands like service httpd stop and then service lsws start. The switching process involves several other important steps, and must be done using the WHM Plugin or the SSH command above.

Set Up Cache Root and Enable LiteSpeed Cache Throughout the Server

Tip

This step is only needed, If Deploy LSCache was set to 0 during installation.

Apart from being an excellent web server, one of the most talked-about features of LiteSpeed is its full page cache, which is particularly popular with known CMS’s such as WordPress and Magento. Though these features are included with every LiteSpeed license, you’ll need to enable LiteSpeed Cache manually and set up the cache root to use these features on the server.

Click LSCWP Version Manager inside the LiteSpeed WHM Plugin, select the desired version (latest is recommended), and click Switch Version.

Make your way through the LiteSpeed Configuration options on the main plugin page. On the next page, click Cache Root Setup Click Set Missing Cache Roots if any of the cache root folders are not set up.

Once LiteSpeed Web Server has been installed successfully, and LiteSpeed Cache has been set up, the time will come to enable it on your server's WordPress sites. LiteSpeed provides a centralized dashboard to scan and manage the LiteSpeed Cache plugin for all Wordpress sites on the server.

From the plugin homepage, click Manage Cache Installations. Click Scan to check your complete server for existing and valid Wordpress Installations.

Give the scane a few minutes to complete. You might see some error messages at the bottom of the scan process, but you can safely ignore them as they are mostly about the WordPress installations which are not valid. (For example, database not configured/invalid or WordPress versions older than 4.0). LiteSpeed will automatically flag those installations and will not install the LSCache plugin on them.

Once the scanning is complete, click Mass Enable/Disable Cache, and click Start.

It might take a few minutes to complete, depending on the number of installations scanned in the previous step.

You might see some failed messages here as well for the websites who are already using other WordPress cache plugins. LSCache will not be installed for these sites, but you can manually contact your customers and let them know about the benefits of LiteSpeed Cache. For any other error messages refer to the lsws/log/webcachemgr.log file.

Verify LiteSpeed is Running Correctly on Websites and LiteSpeed Cache is Working

Now that 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.

Click List Accounts and open any customer’s website, and check its headers, like so:

The headers should show Server as LiteSpeed and X-LiteSpeed-Cache as hit or miss.

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.

Install cPanel Front-end Plugin for Clients(Optional)

LiteSpeed also has a front-end cache management plugin for cPanel users. This allows hosting companies to provide a convenient cache management tool to their clients, and allows customers to manage all aspects of their website caching.

Click Install. Once complete, it will show you a success message.

Feel free to make changes to your cPanel plugin's settings after installation using the Settings button on the plugin homepage. This will only show up after the cPanel Plugin is installed successfully.

Ensure that all new WordPress installations get the LiteSpeed Plugin(Optional)

Once you're done with the installation phase, you can utilize our LiteSpeed Cache Manager tool. This allows you to automate the process of scanning for new WP installations, and enabling LSCache on those installations. The tool is located at /usr/local/lsws/admin/misc/lscmctl.

You can run it through cron, if you'd like to automate the process: ./lsmctl scan -n - e

This tool will create an lscm.data file under the lsws/admin/lscdata directory. The -n flag indicates that only new installations will be discovered. The -e flag, instructs the tool to enable LSCWP on all newly-discovered installations after scanning is complete.

Frequently Asked Questions

What if I see a failure message when I request 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.

What should I do if I see "Some pre-built EasyApache PHP installations may be missing the timezoneDB extension." in my WHM Plugin?

The timezoneDB extension will improve your website's speed with LiteSpeed. If you see this in your WHM LiteSpeed Plugin you should click on Resolve Now to install those extensions to match PHP's.

What should I do if I see "lvectl command not found" during installation?

There is nothing to worry about if you see this message during your installation process. It simply means that your cPanel/WHM installation is not on a CloudLinux-based Server. However, if yours is a CloudLinux server and you still see this, please create a ticket with us so that we can take a look.

Will LiteSpeed automatically sync all of my current and new domains?

LiteSpeed is a full-service drop-in replacement for Apache on cPanel 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?

Absolutely, yes! LiteSpeed will build matching PHP's for all of the versions you have installed currently, and for any new versions you add with the same PHP extensions. In short, your Multi PHP Manager or PHP Selectors will work just fine with LiteSpeed.

Please note that as of LSWS 5.3.0, PHP auto-detection has been introduced, and detected PHP will not show up in the WebAdmin Console external app or script handler page.

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.

Which Workers I should install on EasyApache for LiteSpeed?

LiteSpeed Webserver supports mpm_worker or mpm_event. Any other MPM's are not recommended.

Do I need the PHP-FPM setting in WHM?

LiteSpeed only uses LSPHP + LSAPI to run PHP on cPanel/WHM, which is much faster than any other methods of executing PHP. It is not possible to change the PHP handler setting while using LiteSpeed Web Server on cPanel/WHM. This value is ignored when running LiteSpeed.

How do I change the LiteSpeed WebAdmin Console Password?

You may change LiteSpeed WebAdmin Console password, like so:

cd /usr/local/lsws/admin/misc
./admpass.sh

How do I add the LSCache plugin to WordPress websites that were left out during installation?

You can simply chose to re-run the step, if you wish to mass-enable the plugin on the Wordpress installations which were left out. Or you may 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'es, 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.

Info

Feel free to reach out to us for any other questions or issues you may have :) Welcome to the Accelerated Internet by LiteSpeed.