Set up LiteSpeed in cPanel and WHM | Easy Steps
In this article, we want to teach you How To Set up LiteSpeed in cPanel and WHM. 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. You can now proceed to the guide steps below on the Orcacore website to complete the Set up LiteSpeed in cPanel and WHM.
In this guide, we will teach you how to install LiteSpeed in cPanel with Almalinux. To install cPanel on AlmaLinux, you can follow our article How To Set up cPanel and WHM on AlmaLinux.
Now you can follow the steps below to set up the LiteSpeed webserver in cPanel.
1. Install LiteSpeed WHM plugin on AlmaLinux
First, log in to your server as a root user. Update your local package index with the command below:
dnf update -y
Then, switch to the src directory with the command below:
cd /usr/src
Next, use the wget command to download the LiteSpeed installer script for cPanel and WHM:
wget http://www.litespeedtech.com/packages/cpanel/lsws_whm_plugin_install.sh
Run the LiteSpeed WHM plugin script:
sh lsws_whm_plugin_install.sh
When your LiteSpeed WHM plugin installation is completed, you will get the following output:

Now you need to log in to your WHM panel to install LiteSpeed on cPanel/WHM.
2. Install LiteSpeed webserver from cPanel/WHM
At this point, that you have installed the LiteSpeed plugin for cPanel/WHM, you need to navigate to the Plugins section from your cPanel.

Click on LiteSpeed Web Server and install LiteSpeed webserver on WHM.

Next, read the End-User license agreement for LiteSpeed software and check the box next to the I agree.
After that, you need to choose a license type. If you have a license key, choose the use an enterprise license and enter your serial number. But if you don’t have a license key, choose the request a trial license.
In the next part, set your installation options and WebAdmin console login and click on the Install button.

When your installation is completed, you will see the following message. Scroll Down and Click on the ok button.

Now you need to click on the manage cache installations to generate cache management data. Then, press the switch to the LiteSpeed button to replace the LiteSpeed webserver with Apache on WHM.

Confirm the operation and click on the switch to LiteSpeed.

Next, click on the Ok button to complete your LiteSpeed installation.

To verify that your LiteSpeed service is active and running on your server, go to your SSH and run the following command:
systemctl status lshttpd
In your output you will see:

Conclusion
At this point, you have learned to Set up LiteSpeed in cPanel and WHM with AlmaLinux 9. LiteSpeed in cPanel & WHM is a high-performance web server that replaces Apache to improve website speed, security, and resource efficiency. It enhances performance with built-in caching, HTTP/3 support, and better handling of high-traffic loads.
Hope you enjoy it. Please subscribe to us on Facebook, YouTube, and Twitter.
Also, you may like to read the following articles:
Install Let’s Encrypt on cPanel New Version
Resolve cPanel Error ‘PHP PECL imagick fails on PHP 8.3’
Fix cPanel/WHM Installation on Red Hat 6 & 7
Enable Custom Exim Mail HELOs in cPanel
Find a spam script on cPanel
FAQs
Why use LiteSpeed instead of Apache in cPanel?
LiteSpeed delivers faster page loads, lower resource usage, and built-in caching compared to Apache.
Where is the LiteSpeed configuration file located?
The main config file is:/usr/local/lsws/conf/httpd_config.xml
Does LiteSpeed support .htaccess rules?
Yes, LiteSpeed is fully compatible with Apache .htaccess configurations.
Alternative Solutions for Enhanced Web Server Performance in cPanel/WHM
While the article details a straightforward method for installing and configuring LiteSpeed in cPanel/WHM for improved web server performance, there are alternative approaches that can be considered, either independently or in conjunction with LiteSpeed, to further optimize your server environment. Here are two different ways to address the problem of optimizing web server performance:
1. Utilizing Nginx as a Reverse Proxy with Apache
Instead of completely replacing Apache with LiteSpeed, another strategy is to use Nginx as a reverse proxy in front of Apache. This method leverages Nginx’s efficient handling of static content and its ability to manage a high volume of concurrent connections. Apache, in this setup, focuses on processing dynamic content like PHP scripts.
Explanation:
- Nginx as a Reverse Proxy: Nginx sits in front of Apache, receiving all incoming requests. It then determines how to handle each request. For static files (images, CSS, JavaScript), Nginx serves them directly from its cache, bypassing Apache altogether. This significantly reduces the load on Apache.
- Apache for Dynamic Content: For dynamic content that requires processing by PHP or other server-side scripting languages, Nginx proxies the request to Apache. Apache processes the request and returns the output to Nginx, which then delivers it to the client.
- Benefits: This setup provides a balance between Nginx’s speed and efficiency and Apache’s compatibility with various web applications and .htaccess configurations. It also provides an upgrade path to fully migrate to Nginx at a later time if desired.
- Implementation: cPanel offers tools for managing Apache and Nginx. While there isn’t a one-click Nginx reverse proxy solution in cPanel, you can configure it manually. You’ll need to disable the Apache DirectAdmin feature (if enabled) and configure Nginx to listen on ports 80 and 443, and then proxy requests to Apache, which will listen on a different port (e.g., 8080).
Example Nginx Configuration (nginx.conf):
http {
upstream apache {
server 127.0.0.1:8080; # Apache listening port
}
server {
listen 80;
server_name yourdomain.com www.yourdomain.com;
location / {
proxy_pass http://apache;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location ~* .(jpg|jpeg|gif|png|css|js|ico)$ {
expires 30d; # Cache static files for 30 days
access_log off;
}
}
}
Explanation of the configuration:
upstream apache
: Defines a group of backend servers (in this case, Apache) to which Nginx can proxy requests.listen 80
: Nginx listens for incoming HTTP requests on port 80.server_name
: Specifies the domain names for which this configuration applies.location /
: This block handles all requests that don’t match any other location blocks. It proxies these requests to the Apache backend.proxy_pass
: Specifies the address of the upstream server to which the request should be proxied.proxy_set_header
: Sets HTTP headers that are passed to the upstream server. These headers provide information about the original request, such as the host, IP address, and forwarded-for information.location ~* .(jpg|jpeg|gif|png|css|js|ico)$
: This block handles requests for static files.expires 30d
: Sets theCache-Control
header to instruct the browser to cache these files for 30 days.access_log off
: Disables access logging for static files to reduce disk I/O.
This Nginx configuration needs to be placed in your nginx.conf
file, which is usually located in /etc/nginx/nginx.conf
or /usr/local/nginx/conf/nginx.conf
. After making the changes, restart Nginx for the changes to take effect.
2. Optimizing Apache with Caching Modules and Configuration Tweaks
If completely replacing Apache or adding Nginx is not feasible, optimizing Apache itself can yield significant performance improvements. This involves utilizing caching modules like mod_cache
, mod_deflate
for compression, and fine-tuning Apache’s configuration.
Explanation:
mod_cache
: This module enables Apache to cache frequently accessed content in memory, reducing the need to repeatedly retrieve it from disk or regenerate it.mod_deflate
: Compresses HTTP responses before sending them to the client. This reduces the amount of data that needs to be transferred, resulting in faster page load times.- Apache Configuration Tweaks: Adjusting settings like
KeepAlive
,MaxRequestWorkers
, andTimeout
can optimize Apache’s resource utilization and improve its ability to handle concurrent requests. - Implementation: These modules can be enabled and configured through the Apache configuration files (usually located in
/etc/httpd/conf/httpd.conf
or/usr/local/apache/conf/httpd.conf
). cPanel’s EasyApache tool can also be used to enable and manage these modules.
Example Apache Configuration (httpd.conf):
<IfModule mod_cache.c>
CacheEnable disk /cache
CacheDirLength 1
CacheDirLevels 2
CacheMaxFileSize 204800
CacheMinFileSize 1024
</IfModule>
<IfModule mod_deflate.c>
<Location />
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/javascript application/x-javascript
</Location>
</IfModule>
<IfModule mpm_prefork_module>
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxRequestWorkers 150
MaxConnectionsPerChild 0
</IfModule>
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
Explanation of the configuration:
<IfModule mod_cache.c>
: This block enables disk caching.CacheEnable disk /cache
: Enables disk caching for all content under the/cache
directory. You’ll need to create this directory.CacheDirLength
andCacheDirLevels
: Control the directory structure used for caching to avoid having too many files in a single directory.CacheMaxFileSize
andCacheMinFileSize
: Define the maximum and minimum file sizes to cache.
<IfModule mod_deflate.c>
: This block enables compression.AddOutputFilterByType DEFLATE ...
: Specifies the MIME types for which compression should be enabled.
<IfModule mpm_prefork_module>
: This block configures the prefork MPM (Multi-Processing Module). The exact MPM used may vary depending on your server setup.StartServers
,MinSpareServers
,MaxSpareServers
,MaxRequestWorkers
, andMaxConnectionsPerChild
: These directives control how Apache manages processes to handle incoming requests. The specific values will depend on your server’s resources and traffic patterns.
KeepAlive On
: Enables persistent connections, allowing multiple requests to be sent over a single TCP connection.MaxKeepAliveRequests
: Sets the maximum number of requests allowed per persistent connection.KeepAliveTimeout
: Sets the timeout for persistent connections.
Remember to restart Apache after making these changes.
By implementing either of these alternative solutions – using Nginx as a reverse proxy or optimizing Apache directly – you can achieve significant improvements in web server performance within your cPanel/WHM environment, even without completely switching to LiteSpeed. The best approach will depend on your specific needs, technical expertise, and server resources. Each option requires careful testing and monitoring to ensure optimal performance and stability.