搭建localhost的目录环境
、打开系统盘,默认是C:\Windows\System32\drivers\etc,如果系统盘是D盘就打开D:\Windows\System32\drivers\etc:
# 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
127.0.0.1 www.test.com
127.0.0.1 www.fh.com
127.0.0.1 www.test_my.com
首先修改C:\Windows\System32\drivers\etc目录下的 hosts 文件,用记事本打开,加入:
# 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
127.0.0.1 www.test.com
127.0.0.1 www.fh.com
127.0.0.1 www.test_my.com
//127.0.0.1 www.a.com127.0.0.1 www.b.com记得去掉前面的
打开xampp\apache\conf\httpd.conf文件,搜索 “Include conf/extra/httpd-vhosts.conf”,确保前面没有 # 注释符,也就是确保引入了 vhosts 虚拟主机配置文件。效果如下:
# Virtual hosts
Include "conf/extra/httpd-vhosts.conf"
开启了httpd-vhosts.conf,默认a的httpd.conf默认配置失效(确保 httpd-vhosts.conf 文件里也开启了虚拟主机配置,见第3条),访问此IP的域名将全部指向 vhosts.conf 中的第一个虚拟主机。
在虚拟主机设置文件xampp\apache\conf\extra \httpd-vhosts.conf里设置:取消 NameVirtualHost *:80 前面的 ##,这样就启用了 vhosts.conf ,默认的httpd.conf默认配置失效。虚拟主机配置将只设置在httpd-vhosts.conf里。localhost 的目录默认配置记得也按此设置。
<VirtualHost *:80>
ServerAdmin fh@fh.com
DocumentRoot "D:/feihu/xampp/htdocs/mylaravel/public"
ServerName www.fh.com
ErrorLog "logs/fh.com-error.log"
CustomLog "logs/fh.com-access.log" common
</VirtualHost>
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any block.
#
ServerAdmin postmaster@dummy-host.localhost
DocumentRoot "I:/xampp/htdocs/"
ServerName localhost
ServerAlias localhost
ErrorLog "logs/dummy-host.localhost-error.log"
CustomLog "logs/dummy-host.localhost-access.log" combined
ServerAdmin postmaster@dummy-host1.localhost
DocumentRoot "I:/xampp/htdocs/a"
ServerName www.a.com
ServerAlias www.a.com
ErrorLog "logs/dummy-host1.localhost-error.log"
CustomLog "logs/dummy-host1.localhost-access.log" combined
ServerAdmin postmaster@dummy-host2.localhost
DocumentRoot "I:/xampp/htdocs/b/"
ServerName www.b.com
ServerAlias www.b.com
ErrorLog "logs/dummy-host2.localhost-error.log"
CustomLog "logs/dummy-host2.localhost-access.log" combined
//至此,XAMPP 的虚拟主机设置完毕,现在 访问 localhost 还是原来的 XAMPP 的帮助指南,访问 www.a.com 将指向到绑定的 a 目录,访问 www.b.com 将指向到绑定的 b 目录。
搭建localhost的目录环境的更多相关文章
- 史上最全Windows版本搭建安装React Native环境配置
史上最全Windows版本搭建安装React Native环境配置 配置过React Native 环境的都知道,在Windows React Native环境配置有很多坑要跳,为了帮助新手快速无误的 ...
- 阿里云上安装mysql步骤/ 阿里云ECS搭建Java+mysql+tomcat环境
使用阿里云ECS挺长一段时间了.这两天碰巧朋友小白让我一步一步教他在ECS上搭建Java+mysql+tomcat环境,所以把在这里把步骤在这简单整理了一下,以便需要的人查阅. 我购买的阿里云服务器系 ...
- 史上最详细Windows版本搭建安装React Native环境配置 转载,比官网的靠谱亲测可用
史上最详细Windows版本搭建安装React Native环境配置 2016/01/29 | React Native技术文章 | Sky丶清| 95条评论 | 33530 views ...
- 搭建FTP+PAM+MySQL环境
搭建FTP+PAM+MySQL环境 1 搭建环境: CentOS6.5或CentOS6.7 [root@vhost3 ~]# uname -a Linux vhost3 -.el6.x86_64 # ...
- 手把手教你用webpack3搭建react项目(开发环境和生产环境)(一)
开发环境和生产环境整个配置源码在github上,源码地址:github-webpack-react 如果觉得有帮助,点个Star谢谢!! (一)是开发环境,(二)是生产环境. 一.首先创建packag ...
- 15分钟在笔记本上搭建 Kubernetes + Istio开发环境
11月13~15日,KubeCon 上海大会召开,云原生是这个秋天最火热的技术.很多同学来问如何上手 Kubernetes和Istio 服务网格开发.本文将帮助你利用Docker CE桌面版,15分钟 ...
- 使用Vagrant搭建本地python开发环境
使用Vagrant搭建本地python开发环境 关于vagrant:Vagrant是一个基于Ruby的工具,用于创建和部署虚拟化开发环境,它使用Oracle的开源VirtualBox虚拟化系统也可以使 ...
- 使用intellij idea搭建spring-springmvc-mybatis整合框架环境
使用intellij idea搭建spring-springmvc-mybatis整合框架环境 1.打开idea,创建maven项目,File-New-Project 2.选择Maven,勾选Cr ...
- Hadoop2.7.3+HBase1.2.5+ZooKeeper3.4.6搭建分布式集群环境
Hadoop2.7.3+HBase1.2.5+ZooKeeper3.4.6搭建分布式集群环境 一.环境说明 个人理解:zookeeper可以独立搭建集群,hbase本身不能独立搭建集群需要和hadoo ...
随机推荐
- windows上安装ubuntukylin16.04并且在ubuntukylin上安装jdk
1.安装ubuntukylin16.04 教程链接:http://jingyan.baidu.com/article/f71d60379824041ab641d19d.html 我是完全按照这个教程来 ...
- C++虚成员函数表vtable
介绍一下多态是如何实现的,关于如何实现多态,对于程序设计人员来说即使不知道也是完全没有关系的,但是对于加深对多态的理解具有重要意义,故而在此节中稍微阐述一下多态的实现机制. 在C++中通过虚成员函数表 ...
- Java中的注释
代码注释是架起程序设计者与程序阅读者之间的通信桥梁,最大限度的提高团队开发合作效率.也是程序代码可维护性的重要环节之一.所以我们不是为写注释而写注释.下面说一下Javadoc注释规范以及楼主在J2EE ...
- Java实现二叉树先序,中序,后序遍历
以下是我要解析的一个二叉树的模型形状 接下来废话不多直接上代码 一种是用递归的方法,另一种是用堆栈的方法: 首先创建一棵树: public class Node { private int data; ...
- iOS CGRectContainsPoint的用法
判断给定的点是否被一个CGRect包含,可以用CGRectContainsPoint函数 CGPoint point = [touch locationInView:self]; if(CGRectC ...
- Nis+Nfs+Autofs
Nis: NIS服务的应用结构中分为NIS服务器和NIS客户机两种角色 NIS服务器集中维护用户的帐号信息(数据库)供NIS客户机进行查询 用户登录任何一台NIS客户机都会从NIS服务器进行登录认证, ...
- 32bit程序在64bit操作系统下处理重定向细节(转自http://bbs.pediy.com/showthread.php?t=89054)
1. 64bit操作系统的重定向机制以及目的 在64bit操作系统中,为了无缝兼容32bit程序的运行,64bit的Windows操作系统采用重定向机制.目的是为了能让32bit程序在64bit的操作 ...
- prototype原型解析
每个对象都有原型, prototype能够实现实例共享,节约使您有能力向对象添加属性和方法. 如 <script type="text/javascript"> fun ...
- 下载PhpStorm并进行激活
1.首先登陆PhpStorm官网http://www.jetbrains.com/phpstorm/ 点击附图中的download now 按钮 2.第二步根据os x \wind\ linux进行下 ...
- 【第三篇】Volley图片加载之NetworkImageView代码分析
在Volley的使用之加载图片讲过使用NetWorkImageView进行图片加载的例子,本文着重讲解NetWorkImageView内部是如何实现的,以及Volley这个控件有什么特性. 1,通 ...