我尝试使用/etc/hosts
文件将一些网站重定向到本地主机。为此,我使用终端在终端中打开它,sudo nano /etc/hosts
然后修改文件并保存它。作为最后一步,我用sudo killall -HUP mDNSResponder
.
这是我的主机文件的样子:
$ cat /etc/hosts
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 somethig.com
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
Run Code Online (Sandbox Code Playgroud)
这根本行不通。我试图重新启动,但没有运气。我也做了很多研究,但没有在互联网上找到任何有效的答案。操作系统是否仍然使用这个文件,或者这永远不会真正起作用?
我使用的是 macOS 10.13。