Question

Nextjs App, error: [error] 1131#1131: *15 connect() failed (111: Connection refused) while connecting to upstream, client: 103.10.28.220

Hello everyone, please help. I am trying to deploy my nextjs app to my vps, following a tutorial.

However, I am getting the following errors. please help:

2022/10/05 17:39:20 [error] 1131#1131: *15 connect() failed (111: Connection refused) while connecting to upstream, client: 103.10.28.220, server: domain.com.au, request: "GET /sydney HTTP/1.1", upstream: "http://127.0.0.1:3000/sydney", host: "156.67.217.57"
2022/10/05 17:48:04 [error] 1131#1131: *21 connect() failed (111: Connection refused) while connecting to upstream, client: 111.58.49.126, server: domain.com.au, request: "POST /service/deviceService.php HTTP/1.1", upstream: "http://127.0.0.1:3000/service/deviceService.php", host: "player.neloader.com"
2022/10/05 17:48:11 [error] 1131#1131: *23 connect() failed (111: Connection refused) while connecting to upstream, client: 111.58.49.126, server: domain.com.au, request: "POST /service/userService.php HTTP/1.1", upstream: "http://127.0.0.1:3000/service/userService.php", host: "api.neloader.com"
2022/10/05 17:52:31 [error] 1131#1131: *29 connect() failed (111: Connection refused) while connecting to upstream, client: 223.152.107.29, server: domain.com.au, request: "POST /service/userService.php HTTP/1.1", upstream: "http://127.0.0.1:3000/service/userService.php", host: "api.neloader.com"
2022/10/05 17:52:36 [error] 1131#1131: *31 connect() failed (111: Connection refused) while connecting to upstream, client: 223.152.107.29, server: domain.com.au, request: "POST /service/deviceService.php HTTP/1.1", upstream: "http://127.0.0.1:3000/service/deviceService.php", host: "player.neloader.com"
2022/10/05 17:52:40 [error] 1131#1131: *33 connect() failed (111: Connection refused) while connecting to upstream, client: 223.152.107.29, server: domain.com.au, request: "POST /service/userService.php HTTP/1.1", upstream: "http://127.0.0.1:3000/service/userService.php", host: "api.neloader.com"
2022/10/05 17:58:27 [error] 1131#1131: *40 connect() failed (111: Connection refused) while connecting to upstream, client: 66.249.79.81, server: domain.com.au, request: "GET /manual/fr/mod/event.html HTTP/1.1", upstream: "http://127.0.0.1:3000/manual/fr/mod/event.html", host: "www.neplayer.live"
2022/10/05 17:58:52 [error] 1131#1131: *42 connect() failed (111: Connection refused) while connecting to upstream, client: 45.155.126.211, server: domain.com.au, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:3000/", host: "156.67.217.57"


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Accepted Answer

Hi there,

It looks like that your Node.js service is not running on port 3000. Can you verify this with:

netstat -plant | grep 3000

Note that you need to change the proxy port in your Nginx server block to match the port that your Node.js service is listening on.

I’ve answered a similar question on how to troubleshoot this here:

https://www.digitalocean.com/community/questions/502-bad-gateway-nginx-2

Hope that this helps!

Best,

Bobby