Nginx server responds to ip but not domain name
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?
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