window 系统,如何将一个域名,做host映射到本地localhost (127.0.0.1)

技术分享 · Fecmall · 于 4个月前 发布 · 448 次阅读

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

您将上面的域名改成您自己的域名即可

保存即可生效。

共收到 0 条回复
没有找到数据。
添加回复 (需要登录)
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册
Your Site Analytics