在/etc/apache2/httpd.conf需要修改的地方
1.
DocumentRoot "/www"
<Directory "/www">
2.
LoadModule rewrite_module libexec/apache2/mod_rewrite.so
LoadModule php7_module libexec/apache2/libphp7.so
3.
Include /private/etc/apache2/extra/httpd-vhosts.conf
在/etc/apache2/extra/httpd-vhosts.conf新增專案路徑
<VirtualHost *:80>
ServerName xxx.com //本地虛擬域名
DocumentRoot "/xxxx" //本地專案路徑
<Directory "/xxxx"> //本地專案路徑
Options FollowSymLinks IncludesNOEXEC Indexes
DirectoryIndex index.php index.html index index.html default.html default.htm
AllowOverride all
Order Deny,Allow
Allow from all
Require all granted
</Directory>
</VirtualHost>
在/etc/hosts新增虛擬域名
127.0.0.1 xxx.com
重啟命令
sudo apachectl restart