{{ v.name }}
{{ v.cls }}类
{{ v.price }} ¥{{ v.price }}
开始的时候是通过ip来访问网站,但ip是一串数字不容易记忆。后来就弄了个域名。
一级域名baidu.comtaobao.com二级域名www.baidu.comimage.baidu.com三级域名aaa.image.baidu.comdns服务器
dns服务器:把域名解析为ip地址,保存的就是域名和ip的映射关系。一个域名和一个ip地址绑定,一个ip地址可以被多个域名绑定。
常用的dns服务器比如114.114.114.114
在cmd窗口中输入
cmdpingwww.baidu.com
会显示
正在pingwww.a.shifen.com[180.97.33.108]具有32字节的数据
180.97.33.108就是www.baidu.com对应的那个ip地址。
自己测试的话可以本地修改hosts文件,windows的hosts文件在c:windowssystem32driversetc里边
#copyright(c)1993-2009microsoftcorp.##thisisasamplehostsfileusedbymicrosofttcp/ipforwindows.##thisfilecontainsthemappingsofipaddressestohostnames.each#entryshouldbekeptonanindividualline.theipaddressshould#beplacedinthefirstcolumnfollowedbythecorrespondinghostname.#theipaddressandthehostnameshouldbeseparatedbyatleastone#space.##additionally,comments(suchasthese)maybeinsertedonindividual#linesorfollowingthemachinenamedenotedbya'#'symbol.##forexample:##102.54.94.97rhino.acme.com#sourceserver#38.25.63.10x.acme.com#xclienthost#localhostnameresolutionishandledwithindnsitself.#127.0.0.1localhost#::1localhost
然后我再里边添加一句话,然后保存
192.168.110.128www.163.com
当我访问www.163.com的时候就会访问我自己的nginx服务器,而不是访问网易了。
hosts文件里边只能配置ip和域名的映射关系,不能配端口号。
每次改hosts文件都要去其目录中去找,修改起来比较麻烦。可以去github上去下载一个switchhosts来修改hosts文件,并且可以在多个hosts文件间进行切换。
我下载了个0.2.2.18.01版本,这个比较小才8m,最新的解压完都100多m了。