今天打开电脑,准备搭建一个网站项目,所以需要用到phpstudy环境,然后启动study,发现nginx,mysql都运行正常,但是之前的网站项目打不开,怎么回事呢?这时候我记得之前装过系统,电脑重装系统,我们知道重装系统是c盘,而我们项目hosts文件也在c盘,所以查看后发现没了hosts文件,经过配置hosts文件后,网站恢复可以正常打开,特此做个笔记分享如下,最近很忙,没怎么更新文章,后期会继续更新新的内容给大家。
配置 域名和IP的映射关系到hosts文件。
IP: 110.123.11.0
地址: https://lucky.com:16015/app/html/index1.htm
hosts文件作用: hosts文件是一个没有扩展名的系统文件,它的主要作用是能加快域名解析
HOSTS文件是在“c:\windows\system32\drivers\etc(此处C盘为系统盘,如您的系统盘不是C盘则自行变更)。
可以用另一种快捷方法找到:win键+R(在计算机键盘左下角 Ctrl 和 Alt 键之间的按键),在输入框中输入(c:\windows\system32\drivers\etc)即可到达文件目录。
文件找不到 : 如果您按照此方法找不到则是没有打开“隐藏受保护的操作系统文件”,请自行打开(详情百度)。
———————
关于修复hosts文件,作者将自己正常使用的 hosts 文件上传至交流群:761317661,仅供修复使用。
如果不想下载文件请复制以下内容到 hosts文件中 并保存
# 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 localhost127.0.0.1 localhost
127.0.0.1 www.xxx.com
0.0.0.0 account.jetbrains.com