简体   繁体   English

如何使用Nginx-> HAProxy-> Apache在设置中提供静态内容?

[英]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). (无法选择CDN)。

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). 我不应该将它们放入哪台服务器(服务器2和3,这意味着静态请求也会通过HAProxy吗?),或者是否应该在第一个实例中处理静态请求(这种方式,静态内容将从Nginx和存储在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? Nginx和HAProxy应该在不同的服务器上吗?
  2. Server2 and Server3 should have Nginx on :80, then if static, serve it, if not, proxy to Apache on the same server? Server2和Server3应该在:80上具有Nginx,然后如果是静态的,则提供服务;如果不是,则在同一服务器上代理Apache?

堆

I would place the static on server #1 to make the trip as short as possible. 我会将静态对象放在服务器#1上,以使行程尽可能短。 That way you don't have to duplicate static files over server #2 and #3. 这样,您不必在服务器#2和#3上复制静态文件。

Having a load-balancer on the same server as nginx is not a problem at all. 在与nginx相同的服务器上安装负载均衡器根本不是问题。 You could do with nginx alone for a simple load-balancer. 您可以单独使用nginx来实现简单的负载均衡器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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