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

  • 相关阅读:
    bzoj4196: [Noi2015]软件包管理器
    bzoj3083: 遥远的国度
    bzoj4034: [HAOI2015]T2
    2.EXIT_KEY
    AD如何1比1打印
    编程时注意,
    同步事件、异步事件、轮询
    事件位
    挂起进程相关API
    PROCESS_EVENT_POLL事件
  • 原文地址:https://www.cnblogs.com/fstack/p/4619848.html
Copyright © 2011-2022 走看看