Upstream prematurely closed connection

To summarize the changes needed the failure was on
Nginx’s part. The documentation suggests the following values for the
proxy configuration:

proxy_buffer_size           8k;
proxy_buffers               8 32k;
proxy_busy_buffers_size     64k;

However, if you get a 502 error when pushing to RhodeCode through Nginx,
you might have more success using the following values:

proxy_buffer_size           16k;
proxy_buffers               4 16k;
proxy_busy_buffers_size     48k;