Windows使用点托管文件和主机名

时间:2013-10-29 14:55:45

标签: windows file tomcat hosts

这是我的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

x.x.x.x是我的实际IP。我在Windows XP上使用127.0.0.1:80运行Tomcat 6.0服务器(请不要怪我,不要责怪我的机器)。所以,如果我打开localhost或x.x.x.x,我可以看到Tomcat的错误消息(但没关系,因为我没有在URL中放置任何项目名称。)

如果我打开my.hostname1,网络错误页面就是显示器。如果我用{em> my-hostname1 替换我的hosts文件 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

2 个答案:

答案 0 :(得分:4)

我发现这是一个代理问题,现在我在我的网络选项中加了一个例外,exaclty'local *',一切正常。

答案 1 :(得分:0)

主机名不能“。”在他们里面。点用作域名的分隔符。 您可以使用myhostname.domain,其中domain是您的域,或者只是myhostname。

http://en.wikipedia.org/wiki/Fully_qualified_domain_name

了解详情