Apache 和 Nginx 在一起,为什么?

Apache and Nginx together, why?

我已经为我的远程 linux 服务器安装了一个名为 VestaCP (https://vestacp.com/) 的流行控制面板服务。 默认情况下,它同时安装了 apache 和 nginx,但尽管我尽了最大努力,但我仍然无法弄清楚为什么我需要两者。我熟悉 apache 以及如何配置它,但我以前从未使用过 nginx。它似乎是一个更快、更苗条的 apache。你为什么要两个?为什么不选择一个? 在 VstaCP 设置中,我似乎可以 activate/deactivate 一个网站的 Nginx(代理支持 NGINX),但我不能在没有 apache 的情况下单独使用 Nginx。

我发现我有一个 apache conf 和一个 nginx conf 非常相似(写法不同,但逻辑相同)。我不确定,但它表明实际只听了一个,但不确定是哪个。

我很困惑。帮助。

Nginx 是 faster and lighter, but many people find it easier to work with Apache because of .htaccess support (Nginx does not have an analog due to performance concern).

典型的方案如下:将Nginx绑定到端口80,将其配置为提供静态文件(jpg、png、js、css、ttf等),并使其成为代理到 Apache,例如,用于非静态资源的端口 8080。 Apache 反过来具有上述 .htaccess 支持,允许您在不重新加载网络服务器的情况下应用重写规则和其他内容。