3

I have a server with nginx setup. I want it to respond to the domain testhero.in.th.

So in the config file, in my server block, I set server_name testhero.in.th.

I try to access the site through the domain and I get server took too long to respond. So I use dig to see if the domain is pointing to my server. I get an A record pointing to my server. The ip is 188.166.198.107.

I then enter the ip into the address bar and I can then access the site.

To make sure, I tail the access log for nginx. When I try to access the server using the ip, I see the logs, but when I try to access through the domain, I don't.

What steps should I take to find out why I can't access the site through my domain name?

nupac
  • 227
  • 1
  • 3
  • 12

1 Answers1

12

The best bet is that your client is not contacting the server. The steps are the following :

  • double check that there is no dns problem (ie that when you ping testhero.in.th, the IP cobntacted by your client is 188.166.198.107

  • check that your browser is not using a proxy for testhero.in.th ( maybe your browser is configured to use a proxy, but has a list of exception that includes the ip of the server).

  • clean your browser cache.

  • try another browser. wget and curl are good bet.

If everything fails, your can still use tcpdump server side to check if there are incoming connections for your client IP

bgtvfr
  • 1,262
  • 10
  • 20
  • I cleaned my browser cache and it started working. Do you know why that matters? Another issue I encountered when I tried redirecting to https version of the site but then again, it wouldn't respond. Turns out firewall was blocking port 443. All good now. – nupac Sep 20 '16 at 08:45
  • No idea. I edited the answer accoring to your comment in case it helps someone else. The problem was actually client side. – bgtvfr Sep 20 '16 at 14:19
  • Perhaps the browser had the DNS response cached from previous attempts when the name was still pointing to a different IP address? Clearing the cache then fixes the issue. – Tommiie Dec 24 '18 at 10:28