apache LightHttpd 与 Nginx

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/975422/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 17:44:38  来源:igfitidea点击:

LightHttpd vs Nginx

apachenginxlighttpd

提问by drdaeman

Ok, I have seen this question quite a few times here on SO and as well as elsewhere on the web. But..they are all pretty old, so I will post it again.

好的,我在 SO 以及网络上的其他地方已经多次看到这个问题。但是..他们都很老了,所以我会再发一次。

I have the following needs:

我有以下需求:

  1. Ability to handle lots of simultaneous HTTP connections (like comet). This is the reason I am looking at other webservers rather than apache.

  2. Should be easy to install and run PHP

  3. Need reverse proxy for channeling certain requests to an alternate web server (apache or yaws) on another port.

  1. 能够处理大量同时进行的 HTTP 连接(如 Comet)。这就是我查看其他网络服务器而不是 apache 的原因。

  2. 应该易于安装和运行 PHP

  3. 需要反向代理将某些请求引导到另一个端口上的备用 Web 服务器(apache 或 yaws)。

I know nginx does not have fast cgi support by default. While lighthttpd seems to have that, I read complaints about memory leaks. Is the memory leak problem still prevalent?

我知道 nginx 默认没有快速的 cgi 支持。虽然 lighthttpd 似乎有这个功能,但我阅读了有关内存泄漏的投诉。内存泄漏问题仍然普遍存在吗?

What would you recommend now: nginx or lighthttpd? Or something else? Why?

您现在会推荐什么:nginx 或 lighthttpd?或者是其他东西?为什么?

回答by drdaeman

Both have pretty excellent performance. Using FastCGI with Lighttpd is a bit easier, because it is able to spawn processes by itself (downside is that it runs fastcgi servers as the same user as the webserver), while nginx requires a bit of manual work. Both are perfectly capable of acting as reverse proxy and load balancers.

两者都有相当出色的表现。将 FastCGI 与 Lighttpd 一起使用要容易一些,因为它能够自己生成进程(缺点是它以与 web 服务器相同的用户身份运行 fastcgi 服务器),而 nginx 需要一些手动工作。两者都完全能够充当反向代理和负载平衡器。

If you need good performance, I'd also suggest to use nginx as front-end to serve static files, and Apache backend. While this requires more RAM, nginx+apache2+mod_php is somehow faster than nginx+php-fastcgi. I currently have no proof benchmarks, though, so take this statement with a grain of salt.

如果您需要良好的性能,我还建议使用 nginx 作为前端来提供静态文件和 Apache 后端。虽然这需要更多的内存,但 nginx+apache2+mod_php 在某种程度上比 nginx+php-fastcgi 快。不过,我目前没有证据基准,因此请谨慎对待此声明。

Also, IMHO nginx has somehow more human-friendly configuration file syntax, but opinions may vary.

此外,恕我直言,nginx 有某种更人性化的配置文件语法,但意见可能会有所不同。