简体   繁体   English

Nginx服务器中的502错误监视

[英]502 error monitoring in Nginx server

I have a Linux server running Nginx and from time to time it starts throwing a 502 error when trying to access it throw HTTP, and after a while gets back to normal. 我有一个运行Nginx的Linux服务器,并且在尝试访问它时会不时地抛出502错误抛出HTTP,并在一段时间后恢复正常。

I've checked the different logs (Nginx, PHP and MySQL) and didn't find anything that could help me find what's causing this. 我检查了不同的日志(Nginx,PHP和MySQL),但没有找到任何可以帮助我找到导致这种情况的东西。

Any idea where I should look or if it's possible to set any logging/monitorinh tool to help me out? 知道我应该在哪里,或者是否可以设置任何日志/监控工具来帮助我?

Thanks, 谢谢,

502 is a Bad Gateway error. 502是错误网关错误。 You may want to use a log monitoring tool to see these types of errors. 您可能希望使用日志监视工具来查看这些类型的错误。 You may also want to send the PHP errors to see if they are generating fatal errors at the same time. 您可能还希望发送PHP错误,以查看它们是否同时生成致命错误。 I personally use Loggly for this purpose, but you can use other tools available in the market. 我个人使用Loggly来实现此目的,但您可以使用市场上的其他工具。

Also, I would recommend logging Nginx as JSON, and adding to the normal metrics, the uptime for the upstream servers, so that you can see if the 502 errors are also correlated with deteriorating performance. 此外,我建议将Nginx记录为JSON,并向正常指标添加上游服务器的正常运行时间,以便您可以查看502错误是否也与性能下降相关。

If you haven't read this already, I recommend starting here: 如果您还没有看过,我建议从这里开始:

https://www.nginx.com/resources/admin-guide/logging-and-monitoring/ https://www.nginx.com/resources/admin-guide/logging-and-monitoring/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM