大网数据广告活动
服务器运维问答

Nginx server responds to ip but not domain name

· 52CE 我爱测

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…

问题原文

原帖链接 · nupac · CC BY-SA 3.0

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?

已采纳解答

原帖链接 · bgtvfr · CC BY-SA 4.0

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

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-09-20)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0 / CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。