本地域正在 Ping 但无法在浏览器中打开

本地域正在 Ping 但无法在浏览器中打开

我已经设置了本地域例如像这样

mydomain.test

每当我 ping 此域名时,我都会收到以下信息

64 bytes from localhost (127.0.0.1): icmp_seq=87 ttl=64 time=0.028 ms
64 bytes from localhost (127.0.0.1): icmp_seq=88 ttl=64 time=0.027 ms
64 bytes from localhost (127.0.0.1): icmp_seq=89 ttl=64 time=0.028 ms
64 bytes from localhost (127.0.0.1): icmp_seq=90 ttl=64 time=0.030 ms
64 bytes from localhost (127.0.0.1): icmp_seq=91 ttl=64 time=0.028 ms
64 bytes from localhost (127.0.0.1): icmp_seq=92 ttl=64 time=0.028 ms`

但如果我尝试在 chrome 中访问它,我会得到以下信息:

This site can’t be reached mydomain.test’s server IP address could not be found.
Search Google for mydomain test
ERR_NAME_NOT_RESOLVED

我使用以下脚本来设置一切 虚拟主机管理脚本

答案1

sudo nano /etc/hosts 

在您的主机文件中添加此行

127.0.0.1 mydomain.test   

然后按 ctrl+x 然后按 y

然后尝试

相关内容