1.配置 /etc/apache2/httpd.conf
1.1开启相应的模块
# Virtual hosts
Include /private/etc/apache2/extra/httpd-vhosts.conf
1.2配置自己的网站根目录
DocumentRoot "/Users/你的用户名/Documents/Website"
<Directory "/Users/你的用户名/Documents/Website">
Options Indexes FollowSymLinks Multiviews
MultiviewsMatch Any
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
AllowOverride All
Order deny,allow
Allow from all
#
# Controls who can get stuff from this server.
#
Require all granted
</Directory>
2.配置 etc/apache2/extra/httpd-vhosts.conf
<VirtualHost *:80>
DocumentRoot "/Users/jimmy/Documents/Website/xxx"