window 系统,如何将一个域名,做host映射到本地localhost ?
安装fecmall需要域名,但是本地环境没有域名,都是使用127.0.0.1,现在我们来将一个域名映射到本地
譬如将 www.a.com 映射到本地,那么ping
该域名的ip
将是127.0.0.1
1.打开window文件C:\Windows\System32\drivers\etc\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 localhost
127.0.0.1 localhost
我们可以将www.a.com 映射到本地ip,在文件的末尾添加一行数据
127.0.0.1 localhost
127.0.0.1 www.a.com
对于fecmall安装,域名比较多,可以添加
127.0.0.1 www.fecshoptest.com
127.0.0.1 appadmin.fecshoptest.com
127.0.0.1 img.fecshoptest.com
127.0.0.1 m.fecshoptest.com
127.0.0.1 appserver.fecshoptest.com
127.0.0.1 appapi.fecshoptest.com
127.0.0.1 appbdmin.fecshoptest.com
您将上面的域名改成您自己的域名即可
保存即可生效。