【问题标题】:nginx 502 Bad Gateway on big file uploadingnginx 502 大文件上传时出现错误网关
【发布时间】:2015-04-19 18:30:06
【问题描述】:

我有一个带有 apache web 服务器和 nginx 作为代理的服务器。如果我想上传一个 150MB 的文件,它可以毫无问题地工作。但是如果我尝试上传 350MB 的文件(或更大,我必须上传最多 2GB 的文件),我会收到 nginx 502 Bad Gateway 错误。

我正在使用 plesk,我将这些指令添加到 nginx 配置中进行测试:

proxy_buffer_size   256k;
proxy_buffers   8 512k;
proxy_busy_buffers_size   512k;
fastcgi_buffers 8 512k;
fastcgi_buffer_size 512k;

我也增加了client_max_body_size 指令。

我总是收到这个错误:

2015/04/19 11:36:09 [error] 31924#0: *43126352 upstream prematurely closed connection while reading response header from upstream, client: x.x.x.x, server: example.com, request: "POST /uptest HTTP/1.1", upstream: "http://x.x.x.x:7080/uptest", host: "example.com", referrer: "http://example.com/uptest"

我应该改变什么?

【问题讨论】:

    标签: linux nginx proxy


    【解决方案1】:

    FcgidMaxRequestLen 或 FcgidMaxRequestInMem 指令不够大,导致在很多情况下会触发限制 (http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html)。由于Apache中的错误(错误https://issues.apache.org/bugzilla/show_bug.cgi?id=51747),需要配置FcgidMaxRequestInMem

    编辑 fcgid.conf 文件,取决于你的 linux 版本,它可能位于 /etc/httpd/conf.d/ 或 /etc/apache2/mods-available/

    将 FcgidMaxRequestLen 和 FcgidMaxRequestInMem 设置为相同的值,然后重新启动 Apache。

    【讨论】:

    • 非常感谢!你救了我的灵魂!我在nginx中搜索了问题,所以我走错路了......再次坦克。
    猜你喜欢
    • 2013-03-13
    • 1970-01-01
    • 2016-06-23
    • 2011-05-14
    • 2019-06-05
    • 2015-08-10
    • 2016-05-17
    • 2022-12-14
    • 2021-03-22
    相关资源
    最近更新 更多