我们部署了一个Express Web API,它在通过NGINX代理的EC2 ubuntu服务器上运行时获得了相当少的流量(平均每秒约10个请求).每隔一段时间,一个请求就会挂起,如果客户端等待的时间足够长,则会将包含以下内容的行输出到NGINX错误日志:
upstream timed out (110: Connection timed out) while connecting to upstream
Run Code Online (Sandbox Code Playgroud)
我已经在这里尝试了建议的解决方案,但似乎没有效果.这只发生在我们每分钟1-3次的知识上,但我只是关闭这些日志.如果客户端在请求超时之前刷新其页面或导航,则似乎没有记录.
错误消息显然表明连接到上游服务器有什么问题,但为什么这种情况很少发生?导致此问题的URL中绝对没有模式,并且我所知道的代理应用程序仍然可用.这是我们NGINX配置的概念:
user www-data;
worker_processes 4;
pid /run/nginx.pid;
events {
worker_connections 10000;
}
worker_rlimit_nofile 25000;
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
client_max_body_size 15M;
include /etc/nginx/mime.types;
include /etc/nginx/conf.d/ *.conf; //Added space before star because so formatting was turning it into a comment
include /etc/nginx/sites-enabled/ *;
default_type application/octet-stream;
log_format nginx_json '{ "timestamp": "$time_local", '
' "request_ip": "$remote_addr", …Run Code Online (Sandbox Code Playgroud)