一、 添加虚拟域名
sh-3.2# vim /etc/hosts
127.0.0.1 www.cpath.com
二、 配置apache 配置文件
vim /etc/apache2/httpd.conf
# 把注释打开
Include /private/etc/apache2/extra/httpd-vhosts.conf
/etc/apache2/extra/httpd-vhosts.conf
<VirtualHost *:80>
ServerName www.cpath.com
DocumentRoot "/Library/WebServer/Documents"
<Directory "/Library/WebServer/Documents">
Options FollowSymLinks IncludesNOEXEC Indexes
DirectoryIndex index.html index.htm index.php
AllowOverride all
Order Deny,Allow
Allow from all
Require all granted
</Directory>
</VirtualHost>
# 重启apache
sh-3.2# sudo apachectl restart
三、浏览器输入
www.cpath.com