【发布时间】:2014-07-25 22:37:13
【问题描述】:
我花了一天时间解决这个问题,但我无法解决它。
每次我尝试访问我的本地主机或输入 127.0.0.1 时,我使用的浏览器都会返回一个错误,例如:“Firefox 无法在 www.localhost.com 找到服务器地址。”(i'我是法语,我翻译了这个问题)。
在 Google Chrome 和 127.0.0.1 中也会出现同样的问题。我尝试了 XAMPP 和 WAMP,仍然没有。我的 Apache httpd.conf 看起来不错,我尝试更改端口(8080、81、8800)。它仍然无法正常工作。我的 Skype 没有打开下 VMware Workstation。没有程序阻止对端口 80 或 443 的访问。
我已经用 localhost 进行了 ping 测试,一切正常,但我无法访问 WAMP 或 XAMP 的索引页面。
奇怪的是我可以访问 localhost/phpmyadmin 和其他类似的页面。
我认为我的问题出在 Windows 的 hosts 文件中,但对我来说似乎没问题:
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
127.0.0.1 localhost
::1 localhost
我为什么要考虑 hosts 文件?因为我在 XAMPP 和 WAMP 中的虚拟主机不工作。也许我错了,但这个问题让我发疯!
感谢您的帮助
【问题讨论】:
-
主机文件只会将名称映射到 IP,而不是相反。
标签: apache xampp localhost wamp hosts