Nginx 502 Bad Gateway on some search queries

Posted December 4, 2017 3.8k views
NginxMySQLDjangoUbuntu 16.04

Hi guys,
I have written a dictionary website, it works fine, but on some queries i receive bad gateway, the nginx log is written below:

upstream prematurely closed connection while reading response header from upstream

what is my problem exactly, cause everything is fine and it works for most of the queries, and i get response for those queries on my local server.
Is it my server RAM?
My server has 512 MB RAM, and 1 CPU.


These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

Why it is happening.Need a solution.I am fed up with this.
Alzheimers care Tampa