How to serve static content in a setup with Nginx -> HAProxy -> Apache?

In the below stack setup, where could I serve static content? (going with a CDN is not an option).

I'm not getting in which server should I put them (servers 2 and 3, meaning static requests would go through HAProxy too?) or if static request should be served in the 1st instance (this way static content would be served from Nginx and stored in server1).

Nginx (server 1) - Nginx due to SSL
       \/
HAProxy (server 1)
   \/         \/
Server 2   Server 3
(Apache)   (Apache)

Some additional questions:

  1. Nginx and HAProxy should be in different servers?
  2. Server2 and Server3 should have Nginx on :80, then if static, serve it, if not, proxy to Apache on the same server?

Answers


I would place the static on server #1 to make the trip as short as possible. That way you don't have to duplicate static files over server #2 and #3.

Having a load-balancer on the same server as nginx is not a problem at all. You could do with nginx alone for a simple load-balancer.


Need Your Help

How can I elegantly apply a projection to an entire MongoDB collection using Cashbah

mongodb casbah

Assuming that coll is a MongoCollection, I know that I can select all documents by calling coll.find(), and I know that I can apply a projection to all documents by calling coll.find("_id" $exists ...

Alternative to Redirecting command input in windows

windows input batch-file command redirect

Is there any way I coluld use some alternative approch to "redirecting command input" in windows command shell? For example, consider the following command:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.