简体   繁体   English

是什么让nginx / apache成为Web服务器,而不是HAProxy?

[英]What makes nginx/apache a web server, HAProxy not?

What makes nginx/apache a web server, HAProxy not? 是什么让nginx / apache成为Web服务器,而不是HAProxy?

What functionalities HAProxy lacks to be a web server? HAProxy缺少什么功能才能成为Web服务器?

HAProxy can listen on port 80 and can speak HTTP but that's not what people mean when they say "web server." HAProxy可以在端口80上侦听并且可以说HTTP,但这并不是人们说“网络服务器”时的意思。

HAProxy is not a web server, because "web server" implies an HTTP endpoint that can serve static content from files and/or dynamic content generated from code. HAProxy不是Web服务器,因为“Web服务器”意味着可以从文件和/或从代码生成的动态内容提供静态内容的HTTP端点。 That's not what HAProxy is for. 这不是HAProxy的用途。

Technically, there are certain capabilities in HAProxy that can be misused to emulate some capabilities of a web server -- you can serve very small static files from memory buffers and you can generate small dynamic responses using the optional embedded Lua interpreter -- but it is not intended or designed to be used as a web server. 从技术上讲,HAProxy中的某些功能可能被用来模拟Web服务器的某些功能 - 您可以从内存缓冲区提供非常小的静态文件,并且您可以使用可选的嵌入式Lua解释器生成小的动态响应 - 但它是不打算或旨在用作Web服务器。 It's a proxy server -- emulating a web server toward the client, and emulating a client toward the real back-end web server(s) behind it -- because bidirectional emulation is commonly what proxies do. 它是一个代理服务器 - 向客户端模拟Web服务器,并向其后面的真实后端Web服务器模拟客户端 - 因为双向仿真通常是代理所做的事情。

With Nginx and Apache, you can specify a root directory from which files are served, and you can specify paths that are to be serviced by code running in languages like Perl, PHP, Python, etc. Not with HAProxy, because, again, that isn't what it's designed to do. 使用Nginx和Apache,您可以指定从中提供文件的根目录,并且可以指定由Perl,PHP,Python等语言运行的代码服务的路径。不是使用HAProxy,因为,再次,不是它的设计目的。

Both Nginx and Apache can also be used as proxy servers, as HAProxy can, but HAproxy is specifically designed and optimized for that primary purpose -- proxying and load balancing against multiple back-end, selecting the back-end using various rules and algorithms... in essence, HAProxy is an "intermediate router" for HTTP requests, delivering them rather than responding to them. Nginx和Apache也可以用作代理服务器,就像HAProxy一样,但是HAproxy是专门为这个主要目的而设计和优化的 - 针对多个后端的代理和负载平衡,使用各种规则和算法选择后端。 ..实质上,HAProxy是HTTP请求的“中间路由器”,提供它们而不是响应它们。 It can also proxy and load balance non-HTTP protocols that rely on TCP. 它还可以代理和负载平衡依赖于TCP的非HTTP协议。

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

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