windows上安装好服务器后,打开本地目录 C:\Windows\System32\drivers\etc\ ,会看到有个hosts文件,打开后里面的代码为:

# Copyright (c) - 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
# :: localhost

这时我们在最底下添加

     127.0.0.1       www.dev.com

注意,此时前面不能有分号,这样,当我们访问www.dev.com的时候,其实打开的就是localhost了,即使线上已经有www.dev.com这个域名,打开的也是主机上127.0.0.1这个主机了。

如何在本机上将localhost改为www.dev.com的更多相关文章

  1. vue把localhost改成ip地址无法访问—解决方法

    打开package.json文件,找到下面的代码 "scripts": { "dev": "webpack-dev-server --inline - ...

  2. vue2.0项目中 localhost改成ip地址访问

    这里 你可以写成你的ip  那你的项目只能ip访问了,但是写成0.0.0.0的话 你既可已localhost 访问也可以ip访问 也可以写成 127.0.0.1也可以,也能local访问了和ip访问( ...

  3. GitLab 项目创建后地址由Localhost改为实际IP的方法

    进入终端修改以下文件即可. vim /opt/gitlab/embedded/service/gitlab-rails/config/gitlab.yml ## GitLab settings git ...

  4. WebStorm 预览时把浏览器地址localhost 改成IP

    最近在使用WebStorm时,预览网页时地址总是显示的 http://localhost:63342/... ,如果要调试其它设备感觉很不方法,此时肯定首先想到的亲爱的度娘,但是貌似没有真正很解决问题 ...

  5. [DEBUG] ubuntu mysql root@localhost改了密码还是进不去ERROR 1698 (28000)

    之前用skip-grant-tables的方法免密进入Mysql,修改了root的密码, 当时重启服务后是可以用密码进入Mysql的.结果昨天突然又进不去了:) 所以更换方法,特此记录. ====== ...

  6. .net core webapi 将localhost改成ip地址

    用管理员身份运行vs 添加引用 using Microsoft.AspNetCore.Cors; 修改 public void Configure(IApplicationBuilder app, I ...

  7. webstorm预览时把浏览器地址localhost改成IP

    可以通过 File --> Setting,搜索 deployment 点击 + 号 然后输入一个名称,选择:Local or mounted folder,点击 OK 接下来选择你的本地项目路 ...

  8. 修改本机域名localhost为任意你想要的名称

    web项目研发中,测试的时候项目路径与发布以后的路径不一致,项目组之间的路径不一致,这样会加大工作量,这个时候我们可以统一一下开发的路径,这样可以省很多事,话不多说,看下面教程: 在系统盘中的如下路径 ...

  9. jquery中checkbox的选中,反选,全不选 注意1.6版本以上将attr改成prop

    <script type="text/javascript"> $(function () { // 全选 $("#btnCheckAll").bi ...

随机推荐

  1. redis make test报错 Test replication partial resync: ok psync

    更改 tests/integration/replication-psync.tcl 文件: vi tests/integration/replication-psync.tcl 把对应报错的那段代码 ...

  2. Maven3.x 插件开发入门

    Maven工具有很多插件,各种各样的插件,让我们开发调试过程中非常方便,但是终究是有你想要的但是现目前插件不能满足的(可能性非常非常低),这个时候就需要使用其他的替代工具,或者是自己来开发一个Mave ...

  3. log4j里面的info,debug,error级别有什么区别

    一共分为五个级别:DEBUG.INFO.WARN.ERROR和FATAL.这五个级别是有顺序的,DEBUG < INFO < WARN < ERROR < FATAL,明白这一 ...

  4. iOS:UITableView 方法 属性

    参考:https://developer.apple.com/library/iOS/documentation/UIKit/Reference/UITableView_Class/Reference ...

  5. 《QT Creator快速入门》

    ui中的类,这样使用无法通过调试: Ui::Dialog ui(&w); w.show(); 而需要改成: Ui::Dialog ui; ui.setupUi(&w); w.show( ...

  6. git 冲突

    git中冲突会用特殊的标记 (<<<<<<<=======>>>>>>>) 特殊标记<<<< ...

  7. 上传图片到阿里云OSS和获取上传图片的外网url的步骤

    啥都不说  直接上代码 1.html: <form action="/bcis/api/headImgUpload.json" method="post" ...

  8. 新注册域名greenopen.site,向专业道路进军

    新注册域名greenopen.site,向专业道路进军,欢迎访问!届时可以通过 greenopen.site jsxyhelu.github.io 或者jsxyhelu.cnblogs.com 访问本 ...

  9. ReentrantLock的原理学习

    转载:https://my.oschina.net/andylucc/blog/651982 摘要 提到JAVA加锁,我们通常会想到synchronized关键字或者是Java Concurrent ...

  10. 2016年11月8日 星期二 --出埃及记 Exodus 19:24

    2016年11月8日 星期二 --出埃及记 Exodus 19:24 The LORD replied, "Go down and bring Aaron up with you. But ...