IP Connects But Domain Results in 'ERR_CONNECTION_REFUSED'?

Posted August 9, 2021 156 views

Back-end newbie here who hasn’t been able to solve this with search-fu.

The site is working when accessed via the IP address but not the domain– going to the domain returns ‘ERRCONNECTIONREFUSED’.

I set up a PhpMyAdmin droplet. Domain nameservers are all on digital ocean and I have one 'A’ record setup pointing at the IP. Domain is pointing to the correct IP on WhatsMyDNS. HTTP and HTTPS ports are allowed in UFW.

Anyone have insight on what I need to do to get this working? Thanks!

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.

Submit an Answer
2 answers
Show answer This answer has been marked as resolved by psnapier.

Hi there @psnapier,

I could suggest adding a CNAME record for your www version to point to your domain name.

If this does not work, what I could suggest is verifying that your A record points to the correct IP address.

Also, keep in mind that it might take up to a few hours for the DNS cache to clear over the Globe, so for example, if you’ve visited the domain via your browser before adding the A record, it is possible that you might have to wait a bit. To verify that, you could try pinging the domain:


Let me know how it goes!

  • Thank you for the reply!

    Added CNAME record and verified that A record points to the correct IP as suggested.

    Ping is returning replies from the correct IP.

    ‘Connection refused’ error is still occurring when attempting to access the site via the domain (and connecting via the IP is still working fine).

    • Hi there,

      As you can see the correct IP when pinging the domain then indicates that the problem is not related to DNS.

      Have you tried clearing your browser’s cache or accessing the domain via an incognito browser?

      What I could suggest in this case is to check your web server configuration to verify that your domain name is configured correctly.

      What is the web server that you are using and are you using a specific CMS like WordPress for example?