XAMPP集成了PHP开发环境所需要的Apache和Mysql等基础组件。但是系统自带的根目录为/Applications/XAMPP/htdocs。有时候我们希望把网站根目录换成我们自定义的目录文件夹。可通过以下方式来实现

  • 1 打开 应用程序->XAMPP->xamppfiles->etc->httpd.conf 文档
  • 2 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中的路径为你想要的路径,两个的路径要一样

在Mac中有些文件夹是只对本机用户有读写权限,如果是服务器去访问这样的文件夹的话会显示forbidden。例如:在安装WordPress时无法写入配置文件 wp-config.php 等权限问题。解决方法如下:

  • commond + f搜索User/Group,搜到如下结果
# User/Group: The name (or #number) of the user/group to run httpd as. # It is usually good practice to create a dedicated user and group for # running httpd, as with most system services. # User daemon Group daemon 

修改User为你的用户名。以此来获取读写权限

腾讯云限时秒杀【点击购买】

搬瓦工,CN2高速线路,1GB带宽,电信联通优化KVM,延迟低,速度快,建站稳定,搬瓦工BandwagonHost VPS优惠码BWH26FXH3HIQ,支持<支付宝> 【点击购买】!

Vultr$3.5日本节点,512M内存/500G流量/1G带宽,电信联通优化,延迟低,速度快【点击购买】!

阿里云香港、新加坡VPS/1核/1G/25G SSD/1T流量/30M带宽/年付¥288【点击购买】