尝试过一切;仍然“localhost”无法解析

时间:2015-06-01 18:53:21

标签: php apache localhost mamp yosemite

我有一台运行Yosemite(10.10.3)的iMac,我在其上安装了MAMP,Apache和MySQL启动正常但我无法访问任何页面,因为localhost没有解析。

我已经尝试了所有内容,执行了我发现的每个终端命令,刷新了任何可刷新,修改/删除/添加回我的hosts文件中的所有可能组合,重新启动,修改了Mac OS和MAMP上的ServerName变量httpd.conf文件和NOTHING修复了它。

现在,有趣的部分是 127.0.0.1 (:Mac OS Apache为80或WAMP为8888)结算,我得到着名的“它的作品!”如果我尝试 my-macs-name.local (:Mac OS Apache为80或WAMP为8888)

我的主机文件如下所示:

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost 
fe80::1%lo0 localhost

Mac OS Apache httpd.conf文件ServerName部分如下所示:

# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
ServerName localhost:80

WAMP是这样的:

# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
ServerName localhost:8888

Safari(或任何浏览器)返回: enter image description here

ping到localhost返回:

ping: cannot resolve localhost: Unknown host

我已经浏览了Google向我指出的每一个Stack Overflow,博客,互联网教程,但仍然无法解决这个问题。任何帮助将受到高度赞赏。

0 个答案:

没有答案