I've found plenty of DIY posts and tutorials on how to configure Nginx as a load-balancer using upstream server:
upstream backend {
ip_hash;
server 1.2.3.4;
server 1.2.3.5;
server 1.2.3.6;
}
server {
location / {
proxy_pass http://backend;
}
}
But that's the extent to what I can find as far as configuring this architecture. Currently I have a rails application deployed to 3 backend VPS servers and I'm using Unicorn for my HTTP server. Do I need my ruby installed along with my rails application and unicorn on my load-balancing server as well? Do I need Nginx to be installed on each of the upstream servers? If so, how do I configure them? If I introduce something like Varnish to the architecture, where does that go? In front of the load-balancer or each of the backends?
Here's a visual of how I have everything organized:
+---> backend1 <---+
| |
[requests] <---> [Nginx load-balancer]-+---> backend2 <---+-[Database server]
| |
+---> backend3 <---+