Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

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!
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
Hello,
You can only have 1 service listening on 1 port. So as you have Nginx listening on port 80 at the moment, you can not have your Node on the same port.
Also as you currently have your Nginx set to work as a reverse proxy for port 8000, what you could do is to just set Node to listen on port 8000.
This would fix your 502 error.
Here is a link to an answer on how to troubleshoot common Nginx problems:
Here is also a quick video demo on how to do that:
Hope that this helps! Regards, Bobby
I have the same problem, when trying to access the nginx test page
2020/05/23 17:03:43 [error] 9037#9037: *28 connect() failed (111: Connection refused) while connecting to upstream, client: 179.126.139.213, server: hellonode, request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:3000/favicon.ico", host: "165.22.43.156", referrer: "http://165.22.43.156/"
2020/05/23 17:03:43 [error] 9037#9037: *27 connect() failed (111: Connection refused) while connecting to upstream, client: 179.126.139.213, server: hellonode, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:3000/", host: "165.22.43.156"
run the comand netstat -plant
root@know-how-cloud:/# netstat -plant
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 165.22.43.156:3333 0.0.0.0:* LISTEN 6385/node /home/dep
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 9029/nginx: master
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 722/systemd-resolve
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 926/sshd
tcp 0 0 165.22.43.156:22 179.126.139.213:5270 ESTABLISHED 8011/sshd: root@not
tcp 0 0 165.22.43.156:37592 161.35.127.202:25060 ESTABLISHED 6385/node /home/dep
tcp 0 340 165.22.43.156:22 179.126.139.213:1979 ESTABLISHED 5495/sshd: deploy [
tcp 0 1081 165.22.43.156:22 112.85.42.195:41424 FIN_WAIT1 -
tcp 0 0 165.22.43.156:22 222.186.42.7:61212 ESTABLISHED 9455/sshd: [accepte
tcp 0 0 165.22.43.156:80 179.126.139.213:65126 ESTABLISHED 9037/nginx: worker
tcp 0 0 165.22.43.156:80 179.126.139.213:6467 ESTABLISHED 9037/nginx: worker
tcp6 0 0 :::80 :::* LISTEN 9029/nginx: master
tcp6 0 0 :::22 :::* LISTEN 926/sshd
Do you know how I can fix it?
Hi there @moisesalejandro,
What I could suggest in your case is to check your Docker container’s logs for more information on why the connections might be failing.
To do that, you can run the following:
- docker ps -a
- docker logs your_container_id
Feel free to share the logs here! Regards, Bobby