By changing a domain’s DNS I ended up with curl: (6) Could not resolve host
issue. I lost a couple of hours before I resolved. The post is all about how resolved the issue.
I recently installed Vanilla forum on TapThatBrain.com. I wanted Vanilla to send out emails when I register users from Vanilla’s dashboard.
The cloud web hosting that I use doesn’t come with a mail server out the box. So I thought of using a SMTP relay service. Using a SMTP relay service demanded changing the domain’s DNS eventually leading me to the issue — curl: (6) Could not resolve host
issue.
I took the following approach before I finally resolved the issue.
- At first, I thought I messed up my nginx configurations. But my configuration was set up to listen both locations —
tapthatbrain.com
andwww.tapthatbrain.com
. So my nginx config was good. Did you know? You can use command line to verify if nginx configurations are in place before reloading the nginx server. Learn how. - I noticed that when I go to
tapthatbrin.com
, I was redirected towww.tapthatbrain.com
and I wanted to find out where the redirection comes from — nginx, certbot or WordPress. Did you know? You can usecurl -I tapthatbrain.com
to identify the HTTP response using the command line. - The redirection was clearly not from my nginx configuration.
- WordPress may possibly cause the redirection. The values of WP_HOME and WP_SITEURL in WordPress were
www.tapthatbrain.com
. But I wasn’t sure if WordPress caused the redirection. So I used WP CLI to update the value totapthatbrain.com
. But the redirection continued to happen. - Finally, Certbot’s configuration in nginx made the redirection. In that case I know I should be able to access the website using
www.tapthatbrain.com
. But I was not able to access using the www version. - So, my next thought was the router’s DNS cache. Since I use Jio Fiber connection, I followed the steps listed at https://www.reliancedigital.in/solutionbox/how-to-change-your-dns-to-browse-faster-and-safer/ to clear the DNS cache at router level. But clearing the DNS cache at router level didn’t help.
- I thought of accessing the both versions (www and the non-www) of the website using a different internet connection. Fortunately, I was able to access both versions using my mobile data.
- That meant something went wrong at Ubuntu (or system) level. Ubuntu couldn’t resolve the DNS. A quick search on Stack Overflow reveled a solution that worked.
Once I updated the /etc/resolve.conf
file, I was able to access both versions of the website tapthatbrain.com
from my Ubuntu machine.
This issue could seem naive for someone with decent Ubuntu skills. However, I don’t feel I’m put to shame for sharing this instance. Instead, I see this as learning opportunity.
Today, I’m grateful to all my mentors for all their motivation. They made me stronger each day.