mycpen

Mycpen

记录学习历程与受益知识
github
telegram
bilibili

01_Error-Nginx 反代后端接口报错

一。前言#

NGINX 反向代理 后端接口时报错:[error] ...: *1918 readv() failed (104: Connection reset by peer) while reading upstream ...

控制台报错信息

image-20220917210427284

NGINX 错误日志

image-20220917210540055

二。解决办法#

参考文章 http://blog.51yip.com/apachenginx/2203.html

查看 nginx error 错误,发现上传接口报以下错:

2019/10/10 19:58:25 [error] 299784#0: \*5967188 readv() failed (104: Connection reset by peer) while reading upstream, client: 59.34.155.7, server: xxxxxxxx, request: "POST /stream/tracking/file HTTP/1.1", upstream: "http://xxxxxxxx/stream/tracking/file", host: "xxxxxxxx"

这种错误日志不多,第一感觉就是上传文件过大,传输时间过长,然后连接被中断。

当使用nginx作为反向代理时,为了支持长连接,需要做到两点:

从client到nginx的连接是长连接,对于客户端来说,nginx长连接是默认开启的。 从nginx到server的连接是长连接,需要自己开启

注意:keepalive指定的数值是Nginx每个worker连接后端的最大长连接数,而不是整个Nginx的.

作者:海底苍鹰

地址:http://blog.51yip.com/apachenginx/2203.html

三。个人配置记录#

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.