hosts文件的注意项!
参考文献:
hosts文件位置
-
windows下
C:WindowsSystem32driversetchosts
-
linux下
/etc/hosts
hosts文件管理工具—SwitchHosts
使用SwitchHosts配置的host不生效的原因:
-
windows 的 hosts 文件是gbk编码的,SwitchHosts修改的是UTF-8编码的
127.0.0.1 picture.com #文件服务器
上面的配置会由于换行符的问题编码问题导致不生效!
-
如果要后面注释,请使用英文!(推荐)
文件开头有说明:
# 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 picture.com # file server
-
非要写中文请独立一行写注释(推荐)
# 文件服务器 127.0.0.1 picture.com