LiteSpeed vs NGINX vs Apache
So, you’re shopping around for the perfect web hosting provider, but you’re also keen to see what web server technology they’re using, and you have good reason to do so. Web servers are arguably the most important factor to consider while choosing a host.
You’ve probably heard compelling arguments for the most popular options: LiteSpeed, NGINX, and Apache. All three platforms are stable, well-maintained, and feature-rich. You can’t really go wrong with either of them. However, if you get down to the technical details, you’ll start noticing some subtle nuances, which may make you choose one over the other. Let’s look at these nuances.
What is a web server?
A web server is software that stores or hosts all the files (graphical elements, source code, etc.) that make up a website. Whenever you enter the URL of a website in your browser, a HTTP/HTTPS request is sent to the web server that’s hosting the website.
It’s a web server’s responsibility to look at the contents of the request, and send an appropriate response. For example, if a user enters
https://www.hostafrica.com/web-hosting/, the web server must return a response that renders the web hosting page on the user’s browser.
At any time, there can be several users trying to visit different pages of a website. Once again, it’s the web server’s responsibility to serve each of them with the requested content, simultaneously, and as fast as possible.
That’s basically all that a web server does. Now let’s look at how the top 3 web servers fare against each other, in different departments like speed, configuration, OS compatibility, and more. Hopefully, this’ll help you better decide which web server is an ideal fit for your personalised needs.
Take a look at this recent report on web servers usage.
Introducing our contenders: LiteSpeed, NGINX, Apache
Let’s start with Apache since it’s the oldest of the three. Apache is a reliable web server and has been around since 1995. It was the most popular for quite some time.
This was helped by the fact that the software is super user-friendly (more so than NGINX), so a rudimentary knowledge of hosting should be enough to set it up.
Pronounced as Engine X, NGINX is LiteSpeed’s top competitor when it comes to speed and event driven scalability.
NGINX was originally created to improve the function of Apache. Back then it was a reverse proxy and load balancer. Basically, software that helped web servers balance the load of requests and demands.
Now, it’s transformed into a web server of its own and is the most popular choice around the world.
LiteSpeed is the newest of these three challengers, and fast becoming one of the more popular choices. As with NGINX, they took a good look at long-time leader Apache and prioritised speed and customisability.
It’s designed as an Apache drop-in replacement, meaning it’s coded to seamlessly drop in, read, and replace Apache files with a hitch. It’s compatible with many of Apache’s features like .htaccess,
In South Africa, Apache still reigns supreme, but as people become aware of LiteSpeed’s capabilities word will spread from abroad to South African shores, as it so often does.
TL;DR infographic: LiteSpeed vs NGINX vs Apache
We’ve summarised the features below into this TL;DR comparison table infographic:
Apache has a process-based architecture: each HTTP request is handled by a separate process. There is a master process that spawns a new process for every new HTTP request it receives.
The problem with process-based architectures is that there’s a lot of memory overhead: there are as many processes as active connections. In peak hours, your memory utilization may rise exponentially.
If this doesn’t make sense, read our analogy:
On the other hand, NGINX has an event-driven architecture: a new event is generated for every incoming HTTP request.
The event-driven process model works like this: there’s a master process, and multiple worker/helper processes. The master process oversees the management of the entire server, and performs all the privileged operations (reading configurations, binding ports etc.).
The operational workload of the server is distributed across various worker processes.
This is why event-driven architectures are much more lightweight and efficient. Your memory utilisation doesn’t vary too much during peak and off-peak hours, as the same number of worker threads share the load among themselves.
LiteSpeed also has an event-driven architecture that’s very similar to that of NGINX.
Apache’s process-based architecture usually means higher RAM usage and longer response times, especially during peak hours and stress runs.
NGINX is relatively faster than Apache, but LiteSpeed is undoubtedly the fastest of the lot.
The LiteSpeed team deployed WordPress instances on each of the three web servers, and ran a few tests to compute the following benchmarks:
Apache (with their own W3 Total Cache): 826.5 requests per second.
NGINX (with their own FastCGI Cache): 6,025.3 requests per second
LiteSpeed (with LiteSpeed Cache for WordPress): 69,618.5 requests per second
Click on the image below to view their site providing the details of their test environment:
Similar trends have been observed in other bench-marking efforts. Check out this LiteSpeed graph displaying amount of transactions per second:
We ran our own tests on a real website, and this is how Apache compared to LiteSpeed. We used the same site across both platforms, with and without caching enabled.
With Google favoring First Contentful Paint and First Meaningful Paint as part of the Core Web Vital metrics, you can see how much of an improvement LSCache has on these metrics and page speed when properly configured.
Hosting packages with additional resources with us will also see further improvements.
A cache is software used for temporary storage of frequently accessed data. Web server caches store frequently accessed webpages and resources. Here’s how a typical web server operates with caching enabled:
- The browser sends an HTTP request to the server.
- If the requested data is present in the cache, the cache intercepts the request and responds to it, without burdening the web server.
- If the requested data is not present in the cache, the web server responds to the request. The cache may store the data if it matches any configured caching filters.
This decreases the server’s workload, increases the overall performance/bandwidth of the website, and decreases web page load times.
Apache has various caching modules, like:
htcacheclean. You can get access to features like: pre-loading files to memory on startup, implementing caching filters, and server-wide key-value based object caching.
NGINX caching can be enabled via cPanel. Some of the available features are: ability to add multiple users to caching, force-expiry of cache after configured time, and changing the default default location.
LiteSpeed ships with LiteSpeed cache, which has some really handy features like server side caching, ability to cache private and public dynamic content on the same page, and integration with Quic.Cloud CDN.
Quic.Cloud CDN is the only CDN that can cache both static and dynamic WordPress content. LiteSpeed cache plugins are also available for various web applications, like WordPress, OpenCart, XenForo, Laravel, MediaWiki, etc.
Apache supports all Unix (CentOS, Redhat, Fedora etc.) operating systems and MS Windows.
NGINX supports all Unix systems, and has partial support for Windows.
LiteSpeed supports CentOS 7+, Ubuntu 14.04+, Debian 8+, FreeBSD 9+, and Linux kernel 3.0+.
Ease of configuration
The configuration plays an important role, as many people opt for user-friendly systems, be it web servers or almost anything else.
Apache’s .htaccess file makes it super easy to configure your web server. For example, you can implement redirects, password protection, custom error messages, indexing, and much more using this file.
NGINX configurations can be defined via .conf files. You can control things like the number of worker threads, exposed ports, load balancing, and redirects etc.
Virtually all LiteSpeed configurations can be done from an intuitive graphical user interface. E.g. you can create listeners, open firewall ports, implement redirects, and even read Apache’s .htaccess files.
All three web servers support Modsecurity rules, which provide basic protection against some of the most common attack vectors.
Apache has a great record in terms of security, and a vigilant development community that’s quick to fix any security issues that may arise. It also provides various configuration parameters to protect against DDoS and privilege escalation attacks.
NGINX is also fairly secure by design, and has extensive documentation on how to secure NGINX deployments.
Lastly, LiteSpeed also takes security seriously. It ships with reCAPTCHA support, WordPress brute-force attack protection, and numerous other features to protect against DDoS.
Control panel compatibility
Apache can work with cPanel, Kloxo, Ajenti, OpenPanel, and ZPanel etc.
A lot of control panels work with NGINX as well; cPanel, aaPanel, Vesta, and Hestia CP are a few examples.
LiteSpeed can integrate with a host of control panels:
There are numerous third-party modules for NGINX that are maintained by the developer community. Available features range from HTTP digest authentication to dynamic IP locking.
Apache also has a host of third-party modules providing features like SQL connection management, data compression, CGI script execution etc.
LiteSpeed has a few control panel and Cache plugins, along with an API that makes it easy for developers to integrate with third-party applications.
Scripting language support
You can use Apache with various languages, like PHP, Python, and Perl using third-party modules, like
LiteSpeed supports all scripting languages, including Perl, PHP, Python, Ruby, and Java.
Apache currently doesn’t have HTTP/3 support.
NGINX previewed their HTTP/3 support in 2020, and then released a roadmap for the feature in July, 2021.
LiteSpeed has strong and reliable support for HTTP/3.
Apache can run WordPress, Joomla, Drupal, Magento, and various other content management systems.
NGINX can run WordPress, Magento, Drupal, Joomla, PrestaShop etc.
LiteSpeed is compatible with WordPress, Joomla, Drupal, Magento, OpenCart, PrestaShop, Shopware, MediaWiki.
Like we’ve pointed out, each web server has its pros and cons. After much debate amongst ourselves we’ve settled on LiteSpeed.
We’ve decided to board the LiteSpeed train early, allowing us incredible server speeds, resource distribution and allocation, and security. We’d like to think we’re ahead of the curve, and our reviews have been confirming it.
Check out our LiteSpeed hosting page and see what offerings are available to you and your future websites.
That may not be the case for you, however. For example, you may have a lot of memory resources to spare, and prefer Apache’s process-based architecture for your applications.
The bottom-line is that even though LiteSpeed outperforms its counterparts in most departments, that doesn’t mean it’s necessarily the ideal fit for you as well. Try to understand the strengths and weaknesses of each server, see how they match your personalized needs, and then make an informed decision.
Once more, each web server offers something that makes it worth using. We decided LiteSpeed would suit us best and we’ve had plenty of good reviews to supplement our servers purring like a satisfied cat.