Comparison of Nginx, HaProxy and Varnish

Today we will be exploring the main differences between the three most popular Proxy solutions: Nginx, HaProxy, and Varnish. As your application grows, you need to scale to support traffic, DevOps and SysAdmins choose from these three proxy options to install on servers.

Let’s try to see first what a proxy is and a short introduction to servers, and then compare the supported features of each.

What is a proxy?

Proxy it is a server that acts in the presence of other internal servers. Proxies are used to balance traffic, support traffic bursts, protect against DDOS attacks, and achieve high availability for web applications.


Varnish is a reverse HTTP proxy and accelerator for high traffic sites. Unlike others, it only allows proxy and load balancing of HTTP traffic. Varnish is used by Wikipedia, NY Times, The Guardian, and many others. Designed since 2006.


Is the # 1 web server, load balancing and proxy solutions for high traffic sites. It is actively developing, offering a free version and an enterprise version. Used in some of the busiest sites in the world like, Zynga, Airbnb, Hulu, MaxCDN, it is one of the best leading software solutions for achieving high availability and reliable load balancing.


HAProxy is free and open source software that provides load balancing and proxy capabilities for TCP / HTTP protocols. It is well known to be fast and consume few system resources (CPU memory usage). It is compatible with Linux, Solaris, FreeBSD and Windows. It has been actively developing since 2002.

Comparison of Nginx, HaProxy and Varnish

Important: This is a basic comparison, not a complete detailed comparison. If you need complete information about each server, please see the official docs for each product.

Full Web Server StackYesNoNo
Asynchronous concurrencyYesYesNo
Load balancingYesYesYes
SSL OffloadYesYesNo
Dynamic modulesYesNoYes
Administration ConsoleYesYesYes
RealTime statisticsYesYesYes
HTTPD / 2 supportYesYesNo
Windows supportYesYesYes
Proxy cachingYesYesYes
TCP Proxy / LBYesYesYes
UDP Proxy / LBYesNoNo
Proxy mailYesYesNo
Commercial versionYesYesYes
Actively developingYesYesYes


As we saw in the comparison between Nginx, HAProxy and Varnish, the three pieces of software are great for proxy solutions, however, Nginx has a big advantage, not only as a proxy, but a complete web server stack, and has more features than HAProxy and Varnish.

So if you are going to pick one then our suggestion is to go for Nginx, as it can fit in many scenarios, so start using Nginx first, how it can act as a web server, HTTP proxy, mail proxy – server and load balancing if necessary.

Our second choice if you are absolutely sure you don’t need a full web server, the HAProxy stack is packed with features and super lightweight in terms of system resources.

Unfortunately, Varnish is becoming obsolete software for modern web applications, even more so after the launch of HTTP / 2 that they don’t think to be interesting enough to release a supported version of HTTP / 2.

Additional reading: