简体   繁体   中英

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?

堆

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM