I am setting up a Mastodon server on Docker on Ubuntu.

The server is up and running but when I try to access the site from a browser I get the error 502 Bad Gateway.

I have checked that ufw is permitting connections:

ufw status

And I checked that nginx is listening:

netstat -tnlp

Looking in the nginx error log I can see entries such as this one:

2020/07/01 06:47:59 [error] 11686#11686: *1 connect() failed (111:
Connection refused) while connecting to upstream, client:, server: www.canberrasocial.net, request: "GET / HTTP/2.0", upstream:", host: "www.canberrasocial.net"

I also confirmed that Docker is up and running though I see some unusual messages which I don't understand:

systemctl status docker

I'm fairly new to linux admin so my apologies if this is a dumb question, but I'm really stumped as to how to resolve this issue. Hope somebody can help.

  • is your IP address. As for your problem, please see What causes the 'Connection Refused' message?. – Michael Hampton Jul 1 at 15:31
  • Hi Michael. My IP address is You can verify that by pinging the domain. In addition, it's the IP I use to ssh in to the server. That's why I mentioned the address as being confusing for me. – Mark Micallef Jul 2 at 0:49
  • is the IP address of your vultr.com server. The other address is YOUR home address from TPG. – Michael Hampton Jul 2 at 1:39
  • Ahh that makes sense! Sorry, I never thought to check my own home IP. I'll focus then on the connection refused. I did read the link you provided and I had previously allowed connection on the firewall with "ufw allow HTTP" and "ufw allow HTTPS" as one of the steps during the initial setup of my server. I'm a bit more hazy on the other possibility of no process listening as I thought Nginx was listening on :80 and :443 based on the netstat above? – Mark Micallef Jul 2 at 1:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.