(转)修改IIS默认的localhost名称

看惯了http://localhost在本地测试的域名,想换种写法行不行,好比说想变成http://www.ceo.com,但网页访问仍然是原来http://localhost的内容,如何作到呢?app

能够修改本机的一个文件来实现。测试

在系统盘中的以下路径网站

C:\WINDOWS\system32\drivers\etcthis

找到“hosts”文件,右键打开方式选择文本文件方式,能够看到以下内容:spa

复制代码
# 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
复制代码

看到了吧,在最下边一行有code

127.0.0.1 localhostserver

你们知道怎么作了吧?blog

就是在这行下添加新行,将localhost修改成想要的域名,以下get

127.0.0.1 www.ceo.com域名

须要注意的是,“127.0.0.1”和“www.ceo.com”之间用Tab键间隔开

想添加什么域名就接着往下加好了,就这么简单。

添加完成后就保存,而后就能够用www.ceo.com访问本身本地的网站了。

相关文章
相关标签/搜索