Although we have been able to access the local site through localhost, in order to improve the grid, we can modify the host file, set a favorite domain name to point to the local site, it is not more tall.
Clear requirements
The configuration allows us to access the local Web site via http://a.com.
Modify Host
Windows users in
C:\Windows\System32\drivers\etc
The file named hosts is found in the directory. Due to the self-protection settings of Windows, we cannot modify the current file path. So, move the Hosts file to the desktop and open the editor with Notepad. In similar
# 127.0.0.1 localhost
Add a line under the line of code like this:
127.0.0.1 a.com
Save the file, and then move the hosts file to
C:\Windows\System32\drivers\etc
Folder. Then we visit: http://a.com can open our own website.
Summarize
Of course, you can also refer to a domain name such as baidu.com or JD.com for local access. But to do so, you want to visit the real Baidu is not convenient.
Knowledge points
To point a domain name to this machine is 127.0.0.1, so that we can access the local Web services provided by the domain name. Similarly, we enter 127.0.0.1 in the browser address bar to also access the local site. If you know the local area network IP, this IP can also be accessed to the native website. This step is intended to deepen the understanding of the domain name and server.
Modify host to configure domain name access