zoukankan      html  css  js  c++  java
  • xampp配置虚拟域名

    首先使用notpad++(我用的notpad++,记事本也可以)打开(安装xampp目录下的)apach——>conf——>extra——>httpd-vhosts.conf

    在文件的最下面添加如下代码

    <VirtualHost *:80>
    	ServerName xueshuai.com    //访问的域名
    	DocumentRoot "E:WEB-XueShuaiexample**********"    //指向的地址
    	<Directory "E:WEB-XueShuaiexample**********">     //指向的地址
    		Options FollowSymLinks IncludesNOEXEC Indexes
    		DirectoryIndex index.html index.htm index.php
    		AllowOverride all 
    		Order Deny,Allow 
    		Allow from all 
    		Require all granted
    	</Directory>
    </VirtualHost>

    然后使用notpad++(我用的notpad++,记事本也可以)打开C盘——>windows——>system32——>drivers——>etc——>hosts

    在文件的最后添加如下代码

    127.0.0.1 xueshuai.com     //后面是你的虚拟域名

    如果没有hosts这个文件,复制该文件夹下面的任意文件,将其重命名为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

    接下来重启xampp的apach和mysql

    在浏览器中输入你所设置的虚拟域名(xueshuai.com)即可跳转到所指定的位置

    此处有个坑---当把hosts文件下的虚拟域名配置httpd-vhosts.conf里的配置给删掉之后,在浏览器中输入虚拟域名还是会跳转,这是因为浏览器的缓存机制,清除缓存即可

    博主信息:

    昵称:HamyFrank

    网站:我的网站

    邮箱: xueshuai_12@163.com

    QQ:246776020

    QQ群:1063233592

    WeChat:js_cool_100

  • 相关阅读:
    C++三大特性之多态
    内向者沟通圣经:4P法(Preparation,Presence,Push,Practice)
    RTP/RTCP、TCP、UDP、RTMP、RTSP
    网络七层协议
    预防U盘被病毒侵害的方法
    Win8安装程序出现2502、2503错误解决方法
    小L的区间求和
    【剑指offer-12】矩阵中的路径
    【剑指offer】数值的整数次方
    【剑指offer】二进制中1的个数
  • 原文地址:https://www.cnblogs.com/xue-shuai/p/12000631.html
Copyright © 2011-2022 走看看