简体   繁体   English

应用服务器和Nginx通过什么协议进行通信?

[英]What protocol does an app server and nginx communicate through?

Background: Imagine you have a web app with this architecture: A Node App Server(Koa) and an Nginx Web Server in front. 背景:假设您有一个具有以下架构的Web应用程序:前面有一个Node App Server(Koa)和一个Nginx Web Server。

Scenario: Client browser makes a request to Server. 场景:客户端浏览器向服务器发出请求。 It gets picked up by nginx and sent through to app server and app server responses back to nginx and nginx response back to client. 它被nginx拾取并发送到应用服务器,应用服务器响应返回给nginx,nginx响应返回给客户端。

Question: From this interaction, What are the protocols at each request and response? 问题:通过这种交互,每个请求和响应都有哪些协议? Do you configure them, is it http/1 or 1.1 or 2? 您是否配置它们,是http / 1还是1.1或2? is it tcp/ip tcp / ip

Browser Request: TCP/IP ??? 浏览器请求:TCP / IP ??? Nginx Request: ??? Nginx请求:??? App Server Response: ??? 应用服务器响应:??? Nginx Request: ??? Nginx请求:???

What protocol does an app server and nginx communicate through? 应用服务器和Nginx通过什么协议进行通信?

Whatever protocol you've configured. 无论您配置了什么协议。

Imagine you have a web app with this architecture: A Node App Server(Koa) and an Nginx Web Server in front. 假设您有一个具有此体系结构的Web应用程序:前面有一个Node App Server(Koa)和一个Nginx Web Server。

Your Koa app is going to use HTTP. 您的Koa应用将使用HTTP。 Therefore, HTTP is used between Nginx and your app server. 因此,在Nginx和您的应用服务器之间使用HTTP。

Browser Request: TCP/IP ??? 浏览器请求:TCP / IP ???

HTTP is always ran over TCP. HTTP始终通过TCP运行。 The browser will use whichever version of HTTP is supported by itself and the server. 浏览器将使用自身和服务器支持的HTTP版本。

Do you configure them, is it http/1 or 1.1 or 2? 您是否配置它们,是http / 1还是1.1或2?

Yes, you configure it. 是的,您配置它。 Although, Node.js doesn't support HTTP/1.0 properly. 虽然,Node.js不正确支持HTTP / 1.0。 And, HTTP/2 is typically terminated by your web server (Nginx in this example). 并且,HTTP / 2 通常由您的Web服务器(在此示例中为Nginx)终止。 So, it's typical that HTTP/1.1 is used between Nginx and your Node.js app server. 因此, 通常在Nginx和Node.js应用服务器之间使用HTTP / 1.1。 This, obviously, can change if you change it. 显然,如果您进行更改,它可能会更改。

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

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