Nginx vs Apache: Which is the best in 2019? This is the answer.

  Admin      
For two decades Apache has been in control of the web server market which is shrinking day by day. Nginx is also no less successful, but now it is also the source of many high-traffic websites. Apache users might not agree here. That's why people don't have to immediately draw conclusions about which web server is better. The truth is that both form the core of a complete web stack (LAMP and LEMP), and the final choice comes down to the individual needs of each.


For example, people who run the Drupal website often use Apache, while WordPress users seem to prefer Nginx because it is more suitable. Therefore, our goal is to help you understand your own requirements better than giving a one-size recommendation. Therefore, the following comparison between the two will provide an accurate picture.

1. Popularity
Until 2012, more than 65% of websites were based on Apache, because of the size that is not small from its historical heritage. It was one of the first software that pioneered the growth of the World Wide Web. However, time has changed. According to W3Tech.com, on January 14, 2019, Apache (44.4%) was only slightly ahead of Nginx (40.9%) in terms of websites using their servers. Among them, they dominate almost 85% of the web server market.

When it comes to websites with high traffic, the following graph is interesting. Of course, Nginx is far ahead of Apache but lags behind the Google Server that drives websites like YouTube, Gmail and Drive.

At some point, a large number of websites (including this site) migrated from Apache to Nginx. Obviously, the latter is seen as the latest, and a more trendy web server. High traffic websites that are in Apache, for example Wikipedia and the New York Times, often using HTTP proxies front-end like Varnish.

Value: The popularity gap between Apache and Nginx closes very quickly. However, because Apache still excels in absolute numbers, we will consider this round.

2. Speed
The main characteristic of a good web server is that the server must run fast and easily respond to connections and traffic from anywhere. To measure server speed, we compare two popular travel websites based on Apache (Expedia) and Nginx (Booking.com). Using an online tool called Bitcatcha, comparisons are made for multiple servers and measured by 200 ms Google benchmarks.

Booking.com based on Nginx is rated "very fast." Conversely, Expedia based on Apache is ranked "above average and can be upgraded."

After using both travel websites many times, I can personally ensure that Expedia feels a little slower in returning results to my request than Booking.

Here is a comparison between two servers for several other websites. Nginx does feel faster in all cases below except one.
Value: Nginx wins the speed round.

3. Security
Both Nginx and Apache are very concerned about security on their website. There is no scarcity of a strong system to handle DDoS attacks, malware, and phishing. Both of them periodically release reports and security advice that ensures that security is strengthened at every level.
Value: We will consider this round a series.

4. Concurrency
There is a perception that Apache is somehow incompatible with Nginx's scale and capabilities. However, Nginx was originally designed to speed up speed problems with FastCGI and SCGI handlers. However, from Apache 2.4 onwards (which is the default version), there has been a drastic increase in the number of simultaneous connections. How far this improvement has been done needs to be found out.

Based on stress tests at Loadimpact.com, we compare Booking.com (Nginx) with Expedia (Apache). For 25 virtual users, the Nginx website is capable of recording 200 requests per second, which is 2.5 times higher than 80 Apache requests per second. Obviously, if you have a website with special high traffic, Nginx is a safer bet.
Value: Nginx wins the concurrency round

5. Flexibility
The web server must be flexible enough to allow adjustments. Apache does very well using the .htaccess tool, which is not supported by Nginx. This allows decentralization of administrator tasks. Third and second level admins can be prevented from accessing the main server. In addition, Apache supports more than 60 modules that make it very expandable. There are reasons why Apache is more popular with shared hosting providers.
Value: Apache wins this round.

Other parameters
In the past Nginx did not support Windows OS very well, unlike Apache. Not so anymore. Also, Apache is considered weak to balance the burden and reverse the proxy that has changed now.

Conclusion
Nginx won this contest 2-1. Therefore, the objective comparison between Nginx and Apache on the technical parameters does not provide a complete picture. In the end, our decision is that both web servers are useful in their own way.

While Apache must be used with front-end servers (Nginx itself is an option), Nginx can be better with more adjustments and flexibility.
logoblog

Thank you for reading the article Nginx vs Apache: Which is the best in 2019? This is the answer.

Previous
« Prev Post

No comments:

Post a Comment