mac中更改xampp的根目录

方法一:

  • 1 打开 应用程序->XAMPP->xamppfiles->etc->httpd.conf 文档
  • commond+f搜索htdocs,搜到如下结果
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs"
<Directory "/Applications/XAMPP/xamppfiles/htdocs">
  • 3 修改DocumentRoot和Directory中的路径为你想要的路径,两个的路径要一样

方法二:

  打开xampp -> Manage Servers -> Apache Web Server -> Configure -> Open Conf File ,之后同方法1的第二步

修改完之后在终止apache服务的时候可能会出现如下错误:

Stopping Apache Web Server...
Exit code: 8
Stdout:
apache config test fails, aborting
Stderr:
AH00526: Syntax error on line 229 of /Applications/XAMPP/xamppfiles/etc/httpd.conf:
DocumentRoot '/Applications/XAMPP/xamppfiles/\xe2\x80\x9c/Users/****/PhpstormProjects\xe2\x80\x9c' is not a directory, or is not readable

可以看到其中出现  \xe2\x80\x9c  的错误,主要是由于在修改DoucmentRoot时出现中文引号的原因,

“/Users/mac-user/Sites/domain/httpdocs”
This should be:
"/Users/mac-user/Sites/domain/httpdocs"

可参考 

https://stackoverflow.com/questions/27843813/apache-prefixing-path-to-virtual-hosts-path

https://stackoverflow.com/questions/22951499/mac-os-x-xampp-access-forbidden

 

转载于:https://www.cnblogs.com/coding-wtf/p/7130719.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值