这个名称也是一个保留域名(RFC 2606) ,为了避免同狭义定义主机名混淆而单独列出。
在可用其他方式使用计算机主机名称的地方,可以指定主机为localhost。例如,将web服务器上安装的web浏览器指向http://localhost,将会显示运行这个浏览器的计算机上所服务的网站的主页,但是只有当web服务器配置至服务回路接口时才能显示。
一个特殊的DNS主机名,代表分配给引用这个名称的计算机的IP地址。把这个名称看作是提供快速但是不可靠服务的无连接协议。
localhost 指你所在的计算机本身。
在windows系统它成了127.0.0.1的别名 ,在Unix系统下,查看网卡配置会发现作为本地回环的方式,一定程度上使用localhost比127.0.0.1要快一些。
重要重申localhost和IIS、IE、windows无关,它就是指你使用的计算机本身。
在Hosts文件中,localhost指向的IP是127.0.0.1这个关系是可以修改的。
两种方法找到localhost设置:
1、运行 drivers 打开etc文件下hosts 就看到了127.0.0.1 localhost;
2、打开C:\WINDOWS\system32\drivers\etc\hosts文件,此文件可以用记事本打开,打开如下:
# 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