• 本地Apach服务器配置多个域名 方法


    第一步:配置 httpd.conf

        开启 虚拟主机 配置模块 去掉 " Include conf/extra/httpd-vhosts.conf "  前面的" # "

    #Virtual hostsIncludeconf/extra/httpd-vhosts.conf

    第二步:配置 httpd-vhosts.conf

        开始 将自定义的本地域名 与 web目录 关联  这里自定义了 

                   www.royal.org  

                   www.superapp.com  

                   www.api.com 

    这三个本地域名 (当然这三个域名 是不能远程访问的 什么原因 你懂的!)

    1
    2
    3
    4
    5
    6
    7
    <VirtualHost *:80>
    ServerAdmin webmaster@dummy-host2.example.com 
    DocumentRoot "D:\web\apache2.2\Apache2\htdocs\Royal"
    ServerName www.royal.org 
    ErrorLog "logs/dummy-host2.example.com-error.log"
    CustomLog "logs/dummy-host2.example.com-access.log"common 
    </VirtualHost>
    1
    2
    3
    4
    5
    6
    7
    <VirtualHost *:80>
    ServerAdmin webmaster@dummy-host2.example.com 
    DocumentRoot "D:\web\apache2.2\Apache2\htdocs\scApp7"
    ServerName www.superapp.com
    ErrorLog "logs/dummy-host2.example.com-error.log"
    CustomLog "logs/dummy-host2.example.com-access.log"common 
    </VirtualHost>
     
    1
    2
    3
    4
    5
    6
    7
    8
           
    <VirtualHost *:80>
    ServerAdmin webmaster@dummy-host2.example.com 
    DocumentRoot "D:\web\apache2.2\Apache2\htdocs\taobaoApi"
    ServerName www.api.com 
    ErrorLog "logs/dummy-host2.example.com-error.log"
    CustomLog "logs/dummy-host2.example.com-access.log"common
    </VirtualHost>

    第三步: 配置windows hosts文件

        打开 C:\WINDOWS\system32\drivers\etc\hosts 文件 

                       (hosts文件其实 就是 internet 的雏形 最早的internet 是 ARPA 用于内部的 主机的域名解析)

    1
    2
    3
    127.0.0.1 www.royal.org 
    127.0.0.1 www.superapp.com 
    127.0.0.1 www.api.com

    第四步:没哟了! 在浏览器上 输入 www.api.com  www.superapp.com  www.royal.com  就会访问不同德本地web目录

     

        

  • 相关阅读:
    Oracle性能调整ASH,AWR,ADDM
    子网掩码、子网划分详解
    10046事件sql_trace跟踪
    find详解
    date详解
    touch详解
    [转]lsof详解
    iftop、ifstat详解
    iotop详解
    关于Unity的入门游戏飞机大战的开发(上)
  • 原文地址:https://www.cnblogs.com/justphp/p/3009819.html
Copyright © 2020-2023  润新知