本文介绍了如何在Mac上将localhost绑定到127.0.0.1?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的本​​地计算机上有一个正在运行的Web应用程序.要访问它,我可以使用localhost:8080.但是,当我尝试使用http://127.0.0.1:8080地址时,我的浏览器会显示:The 127.0.0.1 page isn’t working.

I have a running web application on my local machine. To get access to it I can use localhost:8080. But when I try to use http://127.0.0.1:8080 address my browser says: The 127.0.0.1 page isn’t working.

无法正常运行:

ping 127.0.0.1:8080
ping: cannot resolve 127.0.0.1:8080: Unknown host

我该如何解决?

推荐答案

打开终端窗口并输入以下行:

Open a terminal window and type this line:

sudo open -a TextEdit /etc/hosts

系统将提示您输入管理员密码,您的主机文件将在TextEdit中打开.在主机文件中添加以下行:

You will be prompt to type in your admin password and your host file will open in TextEdit. Add this line in your host file :

127.0.0.1       localhost

保存文件并关闭.就是这样.

Save the file and close. That's it.

这篇关于如何在Mac上将localhost绑定到127.0.0.1?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 15:39