【发布时间】:2012-04-10 18:09:51
【问题描述】:
嘿,我在 Windows 7 Ultimate 64 位上运行 XAMPP,我的 localhost 设置有一些问题,我已经在互联网上搜索了很长时间试图解决这个问题,但无济于事。
我的设置如下:
我在 XAMPP 上运行 apache 和 mysql 没问题,我编辑了我的 hosts 文件也没问题,确保我在记事本等中使用了管理员权限,并且它没有保存为 .txt 文件等。目前看起来是这样的:
# Copyright (c) 1993-2006 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 handle within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
127.0.0.1 localhost
127.0.0.1 legendary-games.localhost
127.0.0.1 admin.legendary-games.localhost
127.0.0.1 shuuro.legendary-games.localhost
127.0.0.1 yearzero.legendary-games.localhost
127.0.0.1 chess.legendary-games.localhost
我还确保对我在 apache 中的 vhosts 文件进行所有必要的更改,并将其全部指向正确的地址。
现在,当我在浏览器中键入 localhost 时,我得到了我想要的页面,但是如果我尝试任何其他地址,我得到一个找不到页面。我已经尝试 ping 命令提示符中的地址,并且成功返回。我尝试了许多不同的方法来尝试使其正常工作,包括刷新 dns、重新启动 dns、我检查了主机文件是否正在被服务正确查找但无济于事。
任何帮助将不胜感激。
【问题讨论】:
-
为了澄清,当您键入 localhost 时,您会从 htdocs 获得页面显示吗?但是,当您键入不是来自本地托管的地址(例如 google.com)时,您会得到未找到的响应页面?这是你的意思吗?
-
是的,当我在浏览器中输入 localhost 时,我从 htdocs 获取文件,但是当我从主机文件中获取地址之一时,例如legend-games.localhost 这给出了一个找不到页面。正常的互联网 URL 工作正常
-
我明白了。您是否在 apache 上启用了 vhost 模块?如果您已启用,那么您是否添加了别名 legend-games.localhost ?
标签: apache dns xampp localhost