Nginx - sometimes throws 502 Bad Gateway
<p>I've got a project Django, gunicorn, nginx.</p>

<p>It mostly works (most of the endpoints), but sometimes nginx throws 502 BAD GATEWAY.</p>

<p>Error is <code>upstream prematurely closed connection while reading response header from upstream</code>
Do you have any idea what's wrong with it?</p>

<p>Thanks!</p>