Welcome! Log In Create A New Profile

Advanced

Re: Will nginx return 502 without any log in certain case?

Maxim Dounin
September 10, 2018 07:58AM
Hello!

On Fri, Sep 07, 2018 at 06:44:58AM -0400, Fumitaka Yanase wrote:

> I have my nginx running on EC2(Amazon Linux) behind ALB (Load Balancer of
> AWS).
> 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?

If a HTTP response with status code 502 is returned by nginx, it
a) logs a message explaining the problem to the error log at the
"error" level and b) logs the request and the response status to
the access log.

If, however, a 502 error is generated by AWS load balancer, the
exact reason for the error is only known on the AWS load balancer
side. Depending on what exactly happened, there may be something
in nginx logs (not necessary an error) or nothing at all (for
example, if the load balancer wasn't able to connect to nginx).

If you want to further debug this, first of all you may want to
find out where the errors you are seeing are generated.

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Will nginx return 502 without any log in certain case?

Fumitaka Yanase September 07, 2018 06:44AM

Re: Will nginx return 502 without any log in certain case?

Maxim Dounin September 10, 2018 07:58AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 269
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready