win linux hosts 让本地域名指向ip
2012-03-12 23:10
239 查看
1 linux 方式
sudo vi /etc/hosts
出现以下内容
127.0.0.1 localhost
添加域名 指向ip
127.0.0.1 localhost dev.xxxxx.com
或
192.168.1.107 dev.xxxxx.com
2 win 方式
打开C:\WINDOWS\system32\drivers\etc\hosts , 内容如下,设置如下
# Copyright (c) 1993-1999 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
127.0.0.1 localhost
192.168.1.107 dev.xxxxx.com
3 浏览器输入dev.xxxxx.com 就会指向 192.168.1.107
sudo vi /etc/hosts
出现以下内容
127.0.0.1 localhost
添加域名 指向ip
127.0.0.1 localhost dev.xxxxx.com
或
192.168.1.107 dev.xxxxx.com
2 win 方式
打开C:\WINDOWS\system32\drivers\etc\hosts , 内容如下,设置如下
# Copyright (c) 1993-1999 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
127.0.0.1 localhost
192.168.1.107 dev.xxxxx.com
3 浏览器输入dev.xxxxx.com 就会指向 192.168.1.107
相关文章推荐
- hosts+nginx将域名请求指向IP
- Linux C 网络编程 - 获取本地 ip 地址,mac,通过域名获取对应的 ip
- hosts 的设置将域名与iP在本地绑定
- 修改hosts文件在本地使域名解析到指定IP
- 修改hosts文件在本地使域名解析到指定IP
- 修改hosts文件在本地使域名解析到指定IP
- Linux C 网络编程 - 获取本地 ip 地址,mac,通过域名获取对应的 ip 、获取本地主机的名字
- 修改hosts文件在本地使域名解析到指定IP
- Linux C 网络编程 - 获取本地 ip 地址,mac,通过域名获取对应的 ip
- 修改window本地hosts文件,修改域名指向
- linux/win中nginx如何配置一个ip多个域名
- 修改本地hosts表用域名访问本地站点 .
- Linux socket 结构体关系 及 获得本地IP和广播地址
- 万网国际中文域名不能访问被指向ip127.0.0.9或搜狗搜索页面解决办法
- 在linux下,ping域名ping不了,ping ip却可以解决办法
- 如何通过Oray(花生壳)进行域名映射本地IP和端口,应用于本地服务器访问
- 让你的从godaddy注册的域名指向一个IP
- httpclient请求域名自定义域名指向ip
- Linux环境下,apache设置禁止恶意域名绑定和直接ip访问方法
- linux下能ping ip不能ping域名详解