I have a “Bad gateway Error code 502” error. The web application code is located on the Oracale Cloud infrastructure on servers in Germany. Everything worked great for over a year and a half. The application code itself has not changed for half a year. And yesterday this problem appeared. Reading information from the Internet, more than once I came across such a statement that this issue cannot be resolved on its own. This is a problem with DNS servers, proxies, hosting, etc. But in the nginx logs I see errors:
nginx error.log
…
2022/11/28 22:14:02 [error] 1275#1275: *3 connect() failed (111: Connection refused) while connecting to upstream, client: 172.70.127.148, server: netaggregator.ru, request: “GET / HTTP/2.0”, upstream: “http://127.0.0.1:3000/”, host: “netaggregator.ru”
2022/11/28 22:14:02 [error] 1275#1275: *4 connect() failed (111: Connection refused) while connecting to upstream, client: 172.70.126.184, server: netaggregator.ru, request: “GET / HTTP/2.0”, upstream: “http://127.0.0.1:3000/”, host: “netaggregator.ru”
2022/11/28 22:14:02 [error] 1275#1275: *7 connect() failed (111: Connection refused) while connecting to upstream, client: 172.70.126.32, server: netaggregator.ru, request: “GET / HTTP/2.0”, upstream: “http://127.0.0.1:3000/”, host: “netaggregator.ru”
…
nginx access.log
…
172.71.94.36 - - [28/Nov/2022:22:12:06 +0300] “GET /api/chat/list HTTP/2.0” 200 31 “-” “Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:107.0) Gecko/20100101 Firefox/107.0”
172.70.46.130 - - [28/Nov/2022:22:12:06 +0300] “GET /chatbot HTTP/2.0” 200 35952 “-” “Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:107.0) Gecko/20100101 Firefox/107.0”
162.158.92.28 - - [28/Nov/2022:22:12:14 +0300] “POST /api/settings HTTP/2.0” 200 98 “-” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36”
128.1.248.42 - - [28/Nov/2022:22:12:14 +0300] “GET / HTTP/1.1” 200 54179 “-” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36”
172.71.254.15 - - [28/Nov/2022:22:14:02 +0300] “GET / HTTP/1.1” 301 162 “-” “Mozilla/5.0 (compatible; CensysInspect/1.1; +https://about.censys.io/)”
172.70.127.89 - - [28/Nov/2022:22:14:02 +0300] “GET / HTTP/1.1” 301 162 “-” “Mozilla/5.0 (compatible; CensysInspect/1.1; +https://about.censys.io/)”
172.70.127.148 - - [28/Nov/2022:22:14:02 +0300] “GET / HTTP/2.0” 502 150 “-” “Mozilla/5.0 (compatible; CensysInspect/1.1; +https://about.censys.io/)”
172.70.126.184 - - [28/Nov/2022:22:14:02 +0300] “GET / HTTP/2.0” 502 150 “-” “Mozilla/5.0 (compatible; CensysInspect/1.1; +https://about.censys.io/)”
172.70.126.32 - - [28/Nov/2022:22:14:02 +0300] “GET / HTTP/2.0” 502 150 “-” “Mozilla/5.0 (compatible; CensysInspect/1.1; +https://about.censys.io/)”
…
These logs started at the same time. Before that, in a few seconds, everything was given with codes 302 and 200. And then the code 502 went and connection refused. Well, now it continues. I also want to note that apt packages (login and passwd) were updated just around this time, but I tend to think that this is still a coincidence rather than a reason, although I could be wrong. Access to the server from the console works for me, and the webmin administration panel feels great. And the site is 502.
Actually the question is, what should be my steps to fix the problem? In what direction to move? Hope for feedback.