配置本机域名(假域名)与ip映射

简介更改本地服务的端口号为 80 (因为80端口可省略) 如80端口被占用,可见博主的另一篇文章   打开 C:\Windows\System32\drivers\etc 下的 hosts 文件 pyright (c) 1993-2009 Microsoft Corp. # # This is a sample HOSTS file used by Microsoft TCP/IP for Windows. # # This file contains the mappings
更改本地服务的端口号为 80 (因为80端口可省略)

如80端口被占用,可见博主的另一篇文章
 
打开 C:\Windows\System32\drivers\etc 下的 hosts 文件
pyright (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
 

在文件末尾加上    IP地址  假域名(用TAB键隔开)
127.0.0.1www.test.com
现在你就可以直接在本机用www.test.com访问你的服务了!
本文转自:https://blog.csdn.net/qq_36940798/java/article/details/84951220
新加评论 评论标题: