nginx - The server always appears 502 Bad Gateway?
曾经蜡笔没有小新
曾经蜡笔没有小新 2017-05-16 17:26:27
0
4
585

nginx+tomcat cluster construction

But 502 bad Gateway always starts to appear at 7 or 8 o'clock every day.

Can someone help me analyze the reasons for various situations?

error.log record

2014/10/07 07:59:47 [error] 7783#0:
*90920 connect() failed (111: Connection refused) while connecting to upstream, client: 124.133.28.7, server: xx.com, request: "GET / HTTP/1.1", upstream: "http://127.0.1.1: 8888/", host: "xx.com"

曾经蜡笔没有小新
曾经蜡笔没有小新

reply all(4)
我想大声告诉你

Access directly on the server through http://127.0.1.1:8888/ to see if the site is available, and then determine whether there is an nginx configuration problem.

迷茫

Have you added keepalive configuration to your upstream?

upstream backend {
    server http://127.0.0.1:8888;
    keepalive 32;
}

Establish a long connection between nginx and backend to avoid repeatedly creating tcp connections when a large number of requests are made, otherwise 502 will easily occur

I think your situation is related to the specific time period. It is probably caused by the large number of concurrent requests during this time period

In addition, check the memory and CPU usage of your application server during this period. It is also possible that a code bug causes the application server to be unable to respond to more connections

巴扎黑

Maybe there is a problem with the tomcat server or there is a bug in the code

Look at the tomcat log, there may be relevant information

我想大声告诉你

When the tomcat server is inaccessible, ngnix will report 502

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!