如何在本机上将localhost改为www.dev.com
2015-09-13 13:12
197 查看
windows上安装好服务器后,打开本地目录 C:\Windows\System32\drivers\etc\ ,会看到有个hosts文件,打开后里面的代码为:
这时我们在最底下添加
注意,此时前面不能有分号,这样,当我们访问www.dev.com的时候,其实打开的就是localhost了,即使线上已经有www.dev.com这个域名,打开的也是主机上127.0.0.1这个主机了。
# 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 www.dev.com
注意,此时前面不能有分号,这样,当我们访问www.dev.com的时候,其实打开的就是localhost了,即使线上已经有www.dev.com这个域名,打开的也是主机上127.0.0.1这个主机了。
相关文章推荐
- 第二周项目3--体验复杂度--汉诺塔
- 网页/微信中的腾讯视频下载方法
- 泛型算法之堆排
- iOS知识点
- python下载地址到迅雷qq旋风下载
- Shell: nohup守护进程化
- Swift 学习网址精选 By HL
- Nginx Location配置总结
- BestCoder Round #50
- PAT1100. Mars Numbers (20)
- 5、Android网络编程
- bash shell数组
- C++_std::bind std::function 高级用法
- 《javascript高级编程》读书笔记(两)javascript基本概念
- 网易云音乐歌词下载器
- DEDE列表调用有缩图显示缩图,无缩图则不显示缩图的方法
- EditText不自动获得输入焦点(以及 获得焦点但不弹出输入法软键盘的方法)
- ConcurrentHashMap之实现细节
- 任意匹配
- oracle ocfs2 安装配置