【问题标题】:Getting 502 from Nginx when processing node app处理节点应用程序时从 Nginx 获取 502
【发布时间】:2021-11-08 11:46:33
【问题描述】:

我正在运行一个带有 react 和 node 的应用程序,它通过 react 上传 csv 文件,node 然后将它们转换为 json,处理数据,最后它使用 npm exceljs 输出一个 excel 文件,整个事情需要一点时间我的本地环境,但效果很好。

但是当我将它投入生产时,它在处理 excel 文件时出现 502 错误。

我得到的nginx错误日志上除了502之外没有太多信息:

`*271 upstream prematurely closed connection while reading response header from upstream`

我在服务器配置中得到了这个

nginx.conf

sendfile  on;
keepalive_timeout  65;
client_max_body_size 12000M;
client_body_buffer_size 1024k;
client_header_timeout 3000;
client_body_timeout 3000;

fastcgi_read_timeout 3000;
fastcgi_buffers 8 1024k;
fastcgi_buffer_size 1024k;
fastcgi_connect_timeout 3000;
fastcgi_send_timeout 3000;

proxy_buffer_size 1024k;
proxy_buffers 4 1024k;
proxy_busy_buffers_size 1024k;

app.conf

location /opSizing/process {
  proxy_pass http://localhost:5006/opSizing/process;
}

【问题讨论】:

    标签: node.js nginx exceljs


    【解决方案1】:

    在我的情况下,问题是我的服务器内存不足,当节点使用exceljs 写入 xlsx 时,它使用了 2.5G 的内存,超过了我的 linode 允许的最大 RAM音量。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-02-04
      • 2014-01-25
      • 2019-03-14
      • 1970-01-01
      • 2021-07-26
      • 2019-02-26
      相关资源
      最近更新 更多