Compare Nginx and Apache
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. Popularity
- 2. Speed
- 3. Privacy
- 4. Concurrent connection
- 5. Flexibility
- Other parameters
- 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.
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.
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.
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.
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.
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.
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.
You should read it
- How to use Nginx as a reverse proxy
- How to install and run Nginx Server on Windows 10
- 10 Nginx rules to enhance WordPress security
- 8 ways to tweak NGINX performance on Linux
- MSI presents the laptop to play 'dinosaur' GE70 Apache Pro
- How to prevent DDoS attack with Nginx
- How to Install Apache Guacamole via Docker on Ubuntu 22.04
- 10 measures of Apache security
- How to install Apache Netbean on Windows 10
- How to install and configure Apache on Rocky Linux
- How to install Apache, MySQL and PHP in OS X
- Optimize Apache server performance
Maybe you are interested
How to install and configure Apache on Rocky Linux
How to Install Apache Guacamole via Docker on Ubuntu 22.04
How to install Apache Netbean on Windows 10
How to Enable Cross Origin Resource Sharing (CORS) for Sharing Resource Using Apache Servers, PHP and Jquery
How to Set up Php on Apache 2.2.3 on CentOS 5.3
Instructions for creating virtual hosts with Apache in Ubuntu