I was getting a 413 Request Entity Too Large error when uploading files so I changed upload_max_filesize to 10M and post_max_size to 10M. I've also added client_max_body_size 10M; to /etc/nginx/nginx.conf. And before you ask it, yes I have reloaded and restarted nginx. But now I am getting 502 errors and I can figure out why. When I look at the nginx/default-error.log it says:
recv() failed (104: Connection reset by peer) while reading response header from upstream, ...
The file I'm trying to upload is only 5M so this should be rather simple, but of course it's not.
It could because it's hitting the fastcgi timeout, I've had a similar problem. Basically add the below to the http section of your /etc/nginx/nginx.conf file to see if it fixes it:
Yep, I've tried that too. no joy. I've now wasted 4 hours on this and I'm about to loose it. I honestly can not understand what the problem is. Thanks for trying though.
For all those hopeless soles out there also experiencing the "recv() failed (104: Connection reset by peer)" issue, I was only able to resolve this by increasing request_terminate_timeout in /etc/php5/fpm/pool.d/www.conf
I had originally set fastcgi_read_timeout to 300 and I guess those two settings need to be in sync.
The dark beauty of this industry is that to learn something, you must first break it.