这是我的hosts
文件(c:\WINDOWS\system32\drivers\etc)
# Copyright (c) 1993-1999 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
127.0.0.1 localhost
x.x.x.x my.hostname1
#x.x.x.x my.hostname2
xxxx 是我的实际 IP。我正在使用 Windows XP 在 127.0.0.1:80 上运行 Tomcat 6.0 服务器(请不要怪我,而不是我的机器)。因此,如果我打开 localhost 或 xxxx,我可以看到 Tomcat 的错误消息(但没关系,因为我没有在 URL 中输入任何项目名称)。
如果我打开 my.hostname1,则会显示网络错误页面。如果我将hosts
文件my.hostname1替换为my-hostname1,则行为与 localhost 或 xxxx 相同,因此我认为问题在于主机名中的点 (.) 字符。有没有办法在我的主机名中包含一个点?
谢谢
编辑:在 cmd 上运行的输出ping my.hostname1
Pinging my.hostname1[x.x.x.x] with 32 bytes of data:
Reply from x.x.x.x: bytes=32 time<1ms TTL=128
Reply from x.x.x.x: bytes=32 time<1ms TTL=128
Reply from x.x.x.x: bytes=32 time<1ms TTL=128
Reply from x.x.x.x: bytes=32 time<1ms TTL=128
Ping statistics for x.x.x.x:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms