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:
- Nginx and HAProxy should be in different servers?
- Server2 and Server3 should have Nginx on :80, then if static, serve it, if not, proxy to Apache on the same server?
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.