• mac下配置xampp的vhost


    1 先确定在httpd.conf文件(/Applications/XAMPP/xamppfiles/etc/httpd.conf)中,引入了vhosts.conf文件。

      1.1 在httpd.conf搜索'vhosts.conf',把前面的#去掉。

    2 修改vhosts.conf文件(/Applications/XAMPP/xamppfiles/etc/extra/httpd-vhosts.conf)。

    把之前的都注释起来,再新增其他相关的映射。

    如:

    #<VirtualHost *:80>
    #ServerAdmin webmaster@dummy-host2.example.com
    #DocumentRoot "/Applications/XAMPP/xamppfiles/docs/dummy-host2.example.com"
    #ServerName dummy-host2.example.com
    #ErrorLog "logs/dummy-host2.example.com-error_log"
    #CustomLog "logs/dummy-host2.example.com-access_log" common
    #</VirtualHost> 
    
    
    <VirtualHost *:80>
    #访问域名的时候,就会自动映射到下面的文件路径中。
    DocumentRoot "文件路径"
    ServerName 你的域名
    </VirtualHost>

    3 重启服务器试试。

    mac中,可能有权限控制,那就需要用命令行+sudo来编辑文件了。

    //===========20160131补充==========//

    4 更换不同目录,则需要到http.conf文件中修改DocumentRoot和Directory了。

    如下所示:

    #DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs"
    DocumentRoot "/Users/test/others"
    #<Directory "/Applications/XAMPP/xamppfiles/htdocs">
    <Directory "/Users/test/others">

    同时,在http-vhost.conf文件中,加入相关的配置就行:

    <VirtualHost *:80>
        DocumentRoot "/Users/test/others"
        ServerName file1.test.cn
    </VirtualHost>

    可惜:

    只是这样情况,只能在之前和现在的目录,选择一个。也就是,DocumentRoot目录,只能是唯一一个。想用其他的目录做开发,则需要重新配置DocumentRoot目录了。

    参考:

    http://www.cnblogs.com/heiniuhaha/archive/2011/10/14/2212478.html

    http://blog.sina.com.cn/s/blog_43b191a90101ngg9.html

    https://www.zhihu.com/question/28162324

  • 相关阅读:
    UGUI组件之Slider组件简单笔记
    UGUI事件之Drag拖拽事件
    C#的数据类型之最常用的几种类型
    UGUI组件之Text文本组件简单笔记
    UGUI组件之Toggle 组件简单笔记
    Print 与Debug.Log的区别
    Unity脚本用VS打开出现 "以下文件中的行尾不一致,要将行尾标准化吗?"
    UGUI组件之Image 组件简单笔记
    UGUI事件之Pointer指针事件
    定制自己的Unity脚本模板
  • 原文地址:https://www.cnblogs.com/simonbaker/p/4607015.html
Copyright © 2020-2023  润新知