前几日系统重装导致hosts丢失,然后安装了小皮面板后,创建网站会提示:hosts文件可能不存在或被阻止打开,同步hosts失败,今天我们来提供下这个提示的解决方案。
解决办法:
小皮面板安装后,配置本地虚拟域名发现,本地域名不能识别,发现时hosts文件没有生效,解决方案如下:
hosts文件路径:C:\Windows\System32\drivers\etc
第一种情况,hosts文件后缀名错了,先排查hosts文件是否有扩展名,因为hosts文件本身是没有文件扩展名的,如果不小心被加上了如txt等的文件扩展名,就会失效。当然,这么多年还没犯这种错误。
第二种情况,hosts文件格式不正确,hosts文件中是有一定格式的:即单行一个dns的ip地址映射,可以一个ip对应多个域名,每行的ip和域名之间至少有一个空格或TAB键。通常我们直接输入都是正确的,而当我们复制粘贴进来的文本时,有时会因为换行符的问题不生效。解决方案,通过记事本或者notepad++修改即可。
# Copyright (c) 1993-2009 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 # localhost name resolution is handled within DNS itself. # 127.0.0.1 localhost # ::1 localhost |
第三种情况,如果感觉以上办法太麻烦,很简单,从其他电脑复制一份hosts文件放进去即可。
END,以上方法轻松解决小皮面板的提示问题。
转载请注明来源网址:https://www.mubanyun.com/dedecms_az/2828.html
发表评论
评论列表(条)