Compare Nginx and Apache

The truth is that both Apache and Nginx are at the core of the complete web stack (LAMP as well as LEMP) and the final choice depends on the needs of each individual.

For two decades, Apache has changed the web hosting market which is gradually shrinking day by day. Nginx is not only catching up with Apache, but is also the choice of many high-traffic websites. Apache users may disagree on this issue. That is why it is difficult to conclude which web server is better. The truth is that both Apache and Nginx are at the core of the complete web stack (LAMP as well as LEMP) and the final choice depends on the needs of each individual.

For example, people running Drupal websites often choose Apache, while WordPress users seem to favor Nginx more. Accordingly, the goal of this article is to help you better understand your own requirements, instead of providing stereotypical suggestions for everyone. The following comparison between Nginx and Apache will give you an accurate overview.

Is Nginx or Apache a better server?

  1. 1. Popularity
  2. 2. Speed
  3. 3. Privacy
  4. 4. Concurrent connection
  5. 5. Flexibility
  6. Other parameters
  7. Final result

1. Popularity

By 2012, more than 65% of websites were based on Apache. The popularity is not just because of the long history of Apache. This is one of the first pioneering software for the development of the World Wide Web. However, times have changed. According to W3Tech.com, since January 14, 2019, the number of websites using Apache servers (44.4%) is only slightly higher than Nginx (40.9%). Nginx and Apache dominate nearly 85% of the web server market.

Compare Nginx and Apache Picture 1Compare Nginx and Apache Picture 1

When it comes to high-traffic websites, the following chart is interesting. Nginx is on Apache, but it is under Google Servers, a service that provides servers for websites like YouTube, Gmail and Drive.

Compare Nginx and Apache Picture 2Compare Nginx and Apache Picture 2

A large number of websites have moved from Apache to Nginx. Clearly, Nginx is considered a new and more trendy web server. High-traffic websites on Apache, for example, Wikipedia and the New York Times, often use HTTP front-end proxies like Varnish.

Conclusion : The gap in popularity between Apache and Nginx is closing very fast. In this regard, Apache and Nginx blend.

2. Speed

The main feature of a good web host is that it has to run fast, as well as easily respond to connections and traffic from anywhere. To measure server speed, the article compared two popular travel sites based on Apache (Expedia.com) and Nginx (Booking.com). Using an online tool called Bitcatcha, comparisons are made to multiple servers and are measured based on Google's 200 ms benchmark. Booking.com based on Nginx is ranked 'exceptionally fast'. In contrast, Apache.com-based Expedia.com is ranked 'above average and can be improved'.

If you've used both travel sites multiple times, you can confirm that Expedia is a bit slower when returning query results than Booking.

Compare Nginx and Apache Picture 3Compare Nginx and Apache Picture 3

Here is a comparison between the two servers for a few other websites. Nginx is faster in most of the cases below with one exception.

Compare Nginx and Apache Picture 4Compare Nginx and Apache Picture 4

Conclusion : Nginx won this round.

3. Privacy

Both Nginx and Apache take security very seriously on their websites. There is no powerful system that has no countermeasures against DDoS attacks, malware and phishing. Both servers periodically publish security reports and advice, ensuring that the security aspect is enhanced at every level.

Conclusion : Nginx and Apache are tied in this round.

4. Concurrent connection

One thing to note is that Apache is, in a way, incomparable to the size and capabilities of Nginx. After all, Nginx was originally designed to speed up FastCGI and SCGI processors. However, from Apache 2.4 onwards (the default version), there has been a drastic improvement in the number of concurrent connections. How much this improvement has progressed is worth exploring.

Based on the tests at Loadimpact.com, the article compares Booking.com (Nginx) with Expedia.com (Apache). For 25 virtual users, the Nginx website can record 200 requests per second, 2.5 times higher than Apache (80 requests per second). Obviously, if you have a dedicated high-traffic website, Nginx is a safer option.

Compare Nginx and Apache Picture 5Compare Nginx and Apache Picture 5

Conclusion : Nginx won this round.

5. Flexibility

A web server must be flexible enough to allow customizations. Apache does that quite well, through the use of .htaccess tools that Nginx doesn't support. It allows decentralized admin tasks. Third party administrators and secondary administrators may be prevented from accessing the main server. Moreover, Apache supports more than 60 modules, making it highly scalable. That is why Apache is more popular with shared hosting providers.

Compare Nginx and Apache Picture 6Compare Nginx and Apache Picture 6

Conclusion : Apache won this round.

Other parameters

Previously, Nginx did not support the Windows operating system very well, unlike Apache. However, this is no more. In addition, Apache has also been considered quite weak in terms of load balancing and reserve proxy. But things have changed now!

Final result

Nginx narrowly won with a score of 2-1. That said, the objective comparison between Nginx and Apache in terms of specifications gives a complete picture. The final conclusion is that both web hosts are useful on their own.

Although Apache should be used with front-end servers (which Nginx itself is an option), Nginx may be better with more customization and flexibility.

5 ★ | 1 Vote