Guide to Install LiteSpeed Web Server on cPanel/WHM Servers
LiteSpeed Web Server (LSWS), is proprietary web server software. LiteSpeed Web Server is the leading high-performance, high-scalability web server from Litespeed technologies. It can be used to replace an existing Apache server without changing any other programs or operating system details, and without breaking anything. LSWS is compatible with commonly-used Apache features, including mod_rewrite, .htaccess, and mod_security. LSWS can load Apache configuration files directly and works as a drop-in replacement for Apache while fully integrating with popular control panels. LSWS replaces all Apache functions but uses an event-driven approach to handle requests.
Today, in this guide we will learn how we can install LiteSpeed Web Server on cPanel/WHM CentOS Server using Apache WebServer. The entire process is automated and needs no extra steps. Let’s start with the installation process.
Requirements
- Root account login to cPanel/WHM Server
Important Notes
- Please uninstall any Varnish/nginx proxies that are in use in front of cPanel Apache before installing LSWS. Such proxies include Engintron, cPnginx, Cachewall(xVarnish) etc.
- Make sure beforehand that all sites are working fine with Apache.
- PHP must have been built with EasyApache. LiteSpeed will build its matching PHP (with LSAPI) based on this build of PHP.
Procedure
- Log in to the root account of the server.
- Download the auto-installer script and make it executable
wget https://www.litespeedtech.com/packages/cpanel/lsws_whm_autoinstaller.sh
chmod a+x lsws_whm_autoinstaller.sh
- Start the installation with the following command
./lsws_whm_autoinstaller.sh SERIAL_NO [PHP_SUEXEC] [port_offset] [admin_user] [admin_pass] [admin_email] [easyapache_integration] [auto_switch_to_lsws]
Parameters above used are discussed below.- (Required) SERIAL_NO: This will register the server using the serial number specified and retrieve a license key. Inputting TRIAL will cause a trial key to be requested and installed.
- (Optional) PHP_SUEXEC: Available values are 0 (disable), 1 (enable), and 2 (user home directory only). The default value is 2.
- (Optional) port_offset: Controls the Apache port offset. This allows you to run LiteSpeed in parallel with Apache to test it out. For example, if you set port offset to 1000, Apache will continue running on port 80 and LiteSpeed will run on port 1080. If port_offset is set to 0, LiteSpeed will be installed and set to use the same port Apache is currently using, but will not be automatically started after installation unless set to do so in a later parameter. When you are ready to replace Apache with LSWS as your main web server, simply stop Apache and start LiteSpeed (or use the Switch to LiteSpeed button in the WHM plugin). Default value is 1000.
- (Optional) admin_user: Admin username for accessing the LiteSpeed WebAdmin Console. The default value is admin.
- (Optional) admin_pass: Admin password for accessing the LiteSpeed WebAdmin Console. The default value is a1234567.
- (Optional) admin_email: Admin email. This email address will receive important server notices, such as license expiration and server core dumps. The default value is root@localhost.
- (Optional) easyapache_integration: EasyApache Integration, which is applied to EasyApache 3 only and is no longer applicable for EasyApache 4 as there is no need to “build a matching PHP” on EA4. For EasyApache 4, use the EA4 PHP rpms instead. Both 0 and 1 are valid values for EasyApache 4 LSWS installations. For EasyApache 3, easyapache_integration automatically rebuilds matching a PHP for LiteSpeed when you update EasyApache. Available values are 1 (enable) and 0 (disable). The default value is 1.
- (Optional) auto_switch_to_lsws: Automatically switch to LiteSpeed Web Server at the end of the installation. This setting will only take effect if the port offset is set to 0. Available values are 1 (enable) and 0 (disable). Most users will need to test and verify before they switch, so the default value is 0(disabled).
Switch to LiteSpeed Web Server After Installation
- If you did not set the Auto-Installer to automatically switch to LSWS (port_offset set to 0 and auto_switch_to_lsws set to 1), the Auto-Installer will not start LSWS or switch out Apache.To switch to LiteSpeed, open our WHM LiteSpeed Web Server plugin and follow the steps discussed below
- If you set port_offset to > 0
- Start LiteSpeed Web Server using the Restart LiteSpeed button.
- You can now test your sites on the port you’ve set LiteSpeed to. (For example, if your port offset is 1000 and Apache is on port 80, then LSWS will serve on port 1080.)
- If everything works as expected on 1080 port then use the Switch to LiteSpeed button.
- If you set port_offset to 0
- LiteSpeed Web Server is ready and waiting to be your main web server. Clicking the Switch to LiteSpeed button will stop Apache and start LSWS as your main web server.
- If you set port_offset to > 0
With this, we finish the LiteSpeed Web Server installation on the cPanel/WHM Based Server.