简体   繁体   中英

nginx 502 Bad Gateway on big file uploading

I have a server with apache web server and nginx as proxy. If I'd like to upload a 150MB file, it works without any trouble. But If I try to upload a 350MB file (or larger, I must to upload up to 2GB files) I get nginx 502 Bad Gateway error.

I'm using plesk, and I added these directives to nginx config for testing:

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

And I have increased the client_max_body_size directive too.

I get this error always:

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"

What should I change?

The FcgidMaxRequestLen or FcgidMaxRequestInMem directives is not large enough, causing the limit to be triggered in many cases ( http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html ). FcgidMaxRequestInMem is required to configure due to bug in Apache (bug https://issues.apache.org/bugzilla/show_bug.cgi?id=51747 )

Edit fcgid.conffile, which is depending on your linux version could be located in /etc/httpd/conf.d/ or /etc/apache2/mods-available/

Set FcgidMaxRequestLen and FcgidMaxRequestInMem with the same values and then restart Apache.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM