Modify host to configure domain name access

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.