【问题标题】:Failed to load resource: the server responded with a status of 504 (Timeout while reading response from Server) Node.js,Nginx加载资源失败:服务器响应状态为 504(从服务器读取响应时超时)Node.js,Nginx
【发布时间】:2019-01-04 05:53:47
【问题描述】:

在尝试上传大文件时,我收到 504 超时错误。使用 node.js/multer 、 cloudflare 、 nginx 、 ec2。网络不是很好,上传文件需要时间,上传 4-7 分钟后超时。没有发现完全相同的超时时间,它总是随机的

【问题讨论】:

    标签: node.js nginx timeout multer http-status-code-504


    【解决方案1】:

    这可能是由于 Cloudflare 免费包限制您上传大于 50mb 的文件。

    【讨论】:

      【解决方案2】:

      在服务器的 Nginx 配置中,您可能需要更改限制

      client_max_body_size 5M;
      

      到 10M 或任何您的最大文件大小

      client_max_body_size 10M;
      

      如果使用 nginx 代理也会增加超时限制

      proxy_connect_timeout       600;
      proxy_send_timeout          600;
      proxy_read_timeout          600;
      send_timeout                600;
      

      【讨论】:

        猜你喜欢
        • 2017-08-21
        • 2018-07-27
        • 1970-01-01
        • 2021-08-26
        • 2020-02-14
        • 2016-11-01
        • 2018-01-29
        • 2018-12-16
        相关资源
        最近更新 更多