In our environment we us both Nginx and HA Proxy on different clusters. Are there advantages of using one over the other?

Or, what is the best way to go about load balancing a basic LAMP server cluster?

4 Answers 4


(I'm not going into the "best way to load balance", since that's obviously situation specific.)

Both HAProxy and nginx are excellent choices for open-source HTTP load balancers on Unix. At a very high level, the pros and cons that come first to mind are IMHO:


  • Can do SSL offloading (often a biggie).
  • Has a rich set of content processing modules, i.e. header rewriting, content compression, etc.
  • Can sometimes be 'the only HTTPd you need', making administration simpler if you don't need any other HTTPd's.
  • More extensible with plugins, f.x. for routing traffic.


  • Can offer higher single-server performance than nginx (especially when running in TCP mode, 10gbit/s has been demonstrated).
  • IMHO simpler to get up and running for basic plain HTTP load balancing setups.
  • Changes a bit less, especially the slightly older stable branches often go for a while without needing security & stability updates.

But as said, both are excellent choices. Pick the one you feel most comfortable with.

  • 1
    Compression is a big plus for nginx so I ended up going: haproxy + nginx to have simple failover (haproxy) and gzip compression (nginx). Commented Apr 16, 2012 at 14:58

That really depends on what you want to do.

Nginx can split load between clusters, as well as route specific domains to different clusters. Our nginx performance has been satisfactory. It's more like a load router.

For haproxy I know it queries the server status constantly, and will check the server before directing traffic to it. It also has an interface where you can view statistics. nginx I don't think does this on either score.


We use nginx as a webserver, and are very happy with it. I'm never going back to Apache. The downside is if you're intent on running PHP; it requires some hackery-jiggery to make it work under fastCGI.

Don't forget to put Varnish in place for caching! That simple step solves a lot of the problems of sites being Slashdotted/Fireballed!


I'm not an expert on this, but as far as I know HAProxy has better performance and is more configurable in how it does the load balancing.

Now I could throw a list of comparisons and benchmarks at you but I'll just link the google results instead https://encrypted.google.com/search?q=nginx+vs+haproxy

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .