5

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
  • 247

2 Answers2

13

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,292
1

I had same issue using a .dev domain. Turns out that browsers auto switch to httpS for that top level domain, and for other TLD's too, according to the growing HSTS TLD list.

I was bussy setting up my new domain on the server, but httpS was not configured yet. So testing basic http request did not work,as the browser auto forced to httpS.

It is why nothing bgtvfr suggested worked for me, but strangely CURL (free from HSTS policies) on the command line did return html content. I broke my head all day about what it could be.

links: Prevent auto redirect from http to https More about HSTS and TLD lists

rbgo
  • 11