Will nginx return 502 without any log in certain case?

Fumitaka Yanase nginx-forum at forum.nginx.org
Fri Sep 7 10:44:58 UTC 2018

I have my nginx running on EC2(Amazon Linux)  behind ALB (Load Balancer of
Usually it works just fine but very rarely ALB receive 502 bad gateway form
the EC2 instance.

I checked both access.log and error.log of nginx but there is no log for 502
bad gateway.
We asked AWS about the reason of 502, but they told us it should be problem
of web server running on EC2 instance.

After some googling, I found an article that when nginx sends TCP RST or TCP
FIN, it will return 502 without any log output. 
So I'm suggesting I am facing this case, but it there any way to figure out
whether it is so or not?
And if so, is there any way to get some information about why TCP RST or TCP
FIN is caused?

Thanks in advance.

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,281122,281122#msg-281122

More information about the nginx mailing list