zoukankan      html  css  js  c++  java
  • 转载:mac系统XAMPP配置虚拟主机

    安装完xampp后,想添加一个virsualhost,一直报错。查了半天资料,都是乱说,后来看到了一篇国外的文章,终于弄出来了,整理一下。

    第一步,配置本地hosts

    sudo vi /etc/hosts

    在后面添加你的域名xxx.com

    127.0.0.1   xxx.com

    第二步 启用apache的虚拟主机功能

    打开配置文件 vi /Applications/XAMPP/xamppfiles/etc/httpd.conf

    找到下面这一行,去掉最前面的#

    #Include /Applications/XAMPP/etc/extra/httpd-vhosts.conf

    第三步 配置虚拟主机

    首先打开配置文件 vi /Applications/XAMPP/etc/extra/httpd-vhosts.conf

    清空里面的内容,因为是新安装的,不清空也可以

    先把localhost的virsualhost配置一下,不然会出错,一般都是卡在这里了。我的网站编辑器有问题,查看页面源码可以看到配置文件。

    默认虚拟主机

    <virtualhost *:80>

            ServerName localhost

            DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs"

            <directory "/Applications/XAMPP/xamppfiles/htdocs">

           Options Indexes FollowSymLinks Includes execCGI

           AllowOverride All

           Require all granted

       </directory>

    </virtualhost>

    然后添加自己的虚拟主机

    <virtualhost *:80>

        ServerName mysite.local

        DocumentRoot "/Users/yourusername/path/to/your/site"

        <directory "/Users/yourusername/path/to/your/site">

            Options Indexes FollowSymLinks Includes ExecCGI

            AllowOverride All

            Require all granted

        </directory>

        ErrorLog "logs/mysite.local-error_log"

    </virtualhost>

    第四步 如果经过以上步骤重启apache还是有403错误, 就找到/Applications/XAMPP/xamppfiles/etc/httpd.conf

    修改里面的User和Group, User修改为你的电脑的用户名, group修改为staff

    也就是

    #User daemon

    User mac

    #Group daemon

    Group staff

  • 相关阅读:
    (兼容IE8)的渐变
    左侧固定,右侧自适应,两列等高并且自适应的第二种办法
    左侧定宽,右侧自适应,两列布局且等高
    下拉框重写
    在页面中输出当前客户端时间
    用哈希表去数组重复项,有详细注释
    求数组最大值、求和、乘法表、取整
    类似新浪微博输入字符计数的效果
    将博客搬至CSDN
    Mysql常用操作
  • 原文地址:https://www.cnblogs.com/fstack/p/4619848.html
Copyright © 2011-2022 走看看