编辑 /etc/apache2/httpd.conf 文件打开php、vhost、伪静态。

PHP:

LoadModule php7_module libexec/apache2/libphp7.so

VHost:

Include /private/etc/apache2/extra/httpd-vhosts.conf

伪静态:

LoadModule rewrite_module libexec/apache2/mod_rewrite.so
AllowOverride None 改为 AllowOverride All

配置VHost

编辑 /etc/apache2/extra/httpd-vhosts.conf

    <VirtualHost *:80>
    ServerAdmin xuxin
    DocumentRoot "/Volumes/My/study"
    ServerName example.com
    ErrorLog "/Volumes/My/study/logs/error_log"
    CustomLog "/Volumes/My/study/logs/access_log" common
    <Directory "/Volumes/My/study">
      Options FollowSymLinks Multiviews Indexes
      MultiviewsMatch Any
      AllowOverride All
      Require all granted
   </Directory>
</VirtualHost>

重启

sudo apachectl restart