Mac开启自带的Apache服务器

OSX版本10.13.6

1、开启 sudo apachectl start

2、关闭 sudo apachectl stop

3、重启 sudo apachectl restart

默认的Apache的文件的根目录在/Library/WebServer/Documents,我们可以修改/etc/apache2/httpd.conf文件里面的DocumentRoot的值,修改更目录的路径, DocumentRoot 下面的那个值也需要修改成你的更目录。

修改/etc/apache2/httpd.conf,把Options FollowSymLinks Multiviews改成Options Indexes FollowSymLinks Multiviews

注意:当新的更目录不在/User/你的用户名/文件夹下面的话,会出现没有:Forbidden 403 错误,You don't have permission to access /on this server.

原文地址:https://www.cnblogs.com/kanekiken/p/10882440.html