[Development story] fifth, run your local Web application with the desired domain name

Source: Internet
Author: User

As a web developer, deployed in the local application, we have unlimited familiarity with the localhost, but also infinite helplessness. In any case, different applications are labeled LOCALHOST:XXXX address, as if the web should have a character, only John, Dick such a salutation. In many cases, we may want to have a more personalized URL to represent different applications, then there is no domain name or do not want to bother DNS resolution, so the deployment of local should, there is a nice URL is a good idea. Well, let's try it.

The main work consists of two basic simple steps:

Configuring native Host

Configuring website in IIS

Configuring the host service for this computer

By default, the host file is located in the%systemroot%\system32\drivers\etc\ directory and can only be edited as an administrator. Open "Notepad" with "Run as Administrator" and open the host file to the specified directory as follows:

# 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

Special reminder, before modifying the host file, it is best to make a backup of the original file.

Then we can configure the desired domain name, for example:

# 127.0.0.1 localhost
# ::1 localhost
127.0.0.1 dev.anytao.net
127.0.0.2 prj.anytao.net
127.0.0.3 lab.anytao.net

All of these configurations are valid, which means that in the native environment, The IP address of the 127.0.0.3 can be accessed through the lab.anytao.net, and the 127.0.0.1 address can be accessed through localhost or dev.anytao.net, although 127.0.0.1 is usually localhost by default, so we should try to avoid This configuration.

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.