(轉)修改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訪問本身本地的網站了。

相關文章
相關標籤/搜索