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. JavaEE基础(十五)/集合

    1.集合框架(对象数组的概述和使用) A:案例演示 需求:我有5个学生,请把这个5个学生的信息存储到数组中,并遍历数组,获取得到每一个学生信息. Student[] arr = new Student ...

  2. C#:WiFi

    写的一个简单启动关闭WiFi的类:具体如下 using System; using System.Collections.Generic; using System.Text; using Syste ...

  3. GHOST出错

    error 15:file not found grub问题VFS:Cannot open root device "sda" or unknow-block 可能是磁盘驱动程序问 ...

  4. 每日一九度之 题目1039:Zero-complexity Transposition

    时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:3372 解决:1392 题目描述: You are given a sequence of integer numbers. Zero-co ...

  5. ACM题目————星际之门(一)

    描述 公元3000年,子虚帝国统领着N个星系,原先它们是靠近光束飞船来进行旅行的,近来,X博士发明了星际之门,它利用虫洞技术,一条虫洞可以连通任意的两个星系,使人们不必再待待便可立刻到达目的地. 帝国 ...

  6. ACM第一站————快速排序

    转载请注明出处,谢谢!http://www.cnblogs.com/Asimple/p/5455125.html   快速排序(Quicksort)是对冒泡排序的一种改进.   快速排序由C. A. ...

  7. javascript学习(三) 内置对象

    一:事件(Event)对象 在触发dom事件的时候都会产生一个event对象 type   获取事件类型 target  获取事件目标 stopPropagation()  阻止事件冒泡 preven ...

  8. Poj(2195),最小费用流,SPFA

    题目链接:http://poj.org/problem?id=2195 Going Home Time Limit: 1000MS   Memory Limit: 65536K Total Submi ...

  9. Python网络爬虫Scrapy框架研究 以及 代理设置

    地址:https://github.com/yidao620c/core-scrapy 例子:https://github.com/geekan/scrapy-examples 中文翻译文档: htt ...

  10. c++のdll两种调用方式

    调用DLL有两种方法:静态调用和动态调用. (一).静态调用其步骤如下: 1.把你的youApp.DLL拷到你目标工程(需调用youApp.DLL的工程)的Debug目录下; 2.把你的youApp. ...