Nginx vs Apache vs Litespeed for Magento 2
The choice of the hosting solution keeps many system administrators and Magento store owners busy researching the options. Nginx vs Apache? Or Lightspeed? Open source vs proprietary web hosting?
Here at Aitoc, we constantly search for new tips and hacks to optimize Magento performance. The type of your hosting solution has a great impact on this matter. Want to make an informed choice? Keep on reading.
This post will help you to evaluate the pros and cons of each type of Web server software and decide which option may work best for you.
Apache server software
Spears and arrows.
Along with IIS, Apache is the oldest web server solution on the market. Released back in 1995, this open source software has a lot of powerful features along with some drawbacks.
A few years ago, most store owners used Apache and mod_php, or Fast-CGI to process PHP code. These are small shops that have little traffic. Such clients usually use the services of shared-hosting that doesn’t provide any additional functionality. I wondered why, and most likely the answer is .htaccess.
What is .htaccess?
.htaccess is an Apache configuration file that you can modify without rebooting the server. In this case, the server will perform what is written there. Neat? Not really. Whenever Apache server gets a request, it spends server resources to re-read .htaccess instructions. Now imagine that there are a pile of these files (you are not the only one using the shared hosting). The workload on the server increases.
So, how to optimize the server?
You can place all the instructions from .htaccess to the main Apache configuration file, which is loaded into memory at the server request.
However, when you need to make some changes on the server side in your site performance, you’ll have to ask the hosting company to make these changes and reboot the server (you don’t think you will be allowed to do it by yourself, do you?).
It’s not really convenient for the hosting company, for you, and your server neighbours.
In addition, because of its old architecture Apache is not the fastest server solution on the market. A lot of researches have been made on this topic which you can easily find by googling, so I will not go deep into details on this matter.
What are Apache advantages?
Among the Apache’s advantages I can’t but mention that it’s well documented, has the largest community, and is well supported by the control panels like Cpanel or Plesk.
All this make Apache server easy to administer even without deep immersion into the topic. Besides, an extensive list of Apache modules allows you to empower your server with the needed functionality quickly and hassle-free.
- Broad community support.
- A huge selection of extensions.
- Excellent support for hosting control panels.
- Open Source.
- Outdated architecture (process-driven server).
- Slow processing of static files.
Nginx server software
A secret product of the Russian military machine.
Nginx originally appeared in Russia in the 2000s, and it’s much later than Apache. The developer behind Nginx, Igor Sysoev, was well aware of the Apache’s inefficiency with high loads on servers.
Therefore, Igor chose an asynchronous event-driven architecture to solve this issue.
As a result, Nginx is able to cope with much more significant loads on the system due to the efficient use of resources. This feature has made Nginx a go-to choice for many system administrators.
Today Nginx is actively fighting Apache for the market leadership. According to the W3C, as of April 2019, almost 42% of the active website run on Nginx.
From what I’ve noticed, the absolute majority of Magento store owners with medium and large businesses are pretty happy with the Nginx server.
In recent years, small businesses are also switching to Nginx due to the fact that the hosting vendors have started to actively implement the Nginx support into their products.
Now, in the Magento world, Nginx is becoming the de-facto standard. And if you are still using Apache, it’s a good reason to think of switching to Nginx and ease the battle for server optimization, especially if your competitors already run their stores on Nginx – most likely their stores are running faster than yours.
Wondering what web server you or your competitors are using? We have the answer for you. Enter the URL of your website and see it below.
- Modern event-driven architecture.
- Fast operation / lower consumption of server resources.
- Open Source.
- Well documented.
- They are… none.
In some unique cases Nginx might fail to perform the right way and deliver the expected productivity, but in the context of Magento – it’s now the industry standard and an absolute must-have.
Litespeed server solution
Ride the lightning.
In the world of Magento servers, Litespeed is a dark horse. For my 7-year career as a DevOps specialist, I have seen just a few clients running their store serves on Litespeed.
And this is not surprising because Litespeed, unlike the Fowarites, is a proprietary, closed-source commercial solution. Even though there is Openlitespeed, an open source version of Litespeed, it’s still not the best choice for Magento, and I’ll explain why in a separate post.
Few people want to pay for something that is available for free, right?
However, it’s worth noting that Litespeed is the fastest Magento server solution on the market out there. If you own a high-loaded Magento store, Litespeed may help you to significantly reduce your hosting overhead.
Another Litespeed’s advantage is its full compatibility with Apache including the configuration files, rewrite rules and .htaccess. Therefore, the migration from Litespeed to Apache or vice versa is likely to be smooth.
In addition, the Litespeed product is an advanced solution implemented with the cutting-edge technologies earlier compared to other ones.
For example, UDP-based protocol from Google – quic. It significantly decreases the load on the network by reducing the number of connections between the client and the server. As a result, your site loads faster compared to loading through the standard TCP-based protocols HTTP (S) / SPDY / HTTP2.
Another example is the LiteMage module for Magento, which works much more efficiently than Varnish. We’ll delve deeper into this product and compare its performance with other solutions in the next articles as it worth taking a close look.
- The fastest solution at the Magento market.
- Cutting-edge technology (quic, LiteMage).
- Compatibility with Apache configuration files
- Paid subscription.
MIIS and Lighttpd
Underdogs and … outsiders?
First, MIIS. This is a server from Microsoft, hence the main problem with MIIS is that it works only on Windows. With Magento originally built for Linux, Windows-based solutions fail to provide the maximum performance for this CMS.
It doesn’t mean that you can’t put Magento on MIIS. In fact, you can. But you may be shooting yourself in the foot.
Now Lighttpd. You can put Magento on the Lighttpd server. I even found the configuration files on the network. But according to reviews, Lighttpd allows for less wiggle room.
Aitoc is a young team of passionate professionals delivering robust Magento 2 extensions. Founded in 2001, Aitoc has produced over 100 modules for clients worldwide. The company continuously evolves, now offering a full range of custom ecommerce development services.