mac 本地配置域名访问项目

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/Cpath/article/details/79253781

一、 添加虚拟域名

sh-3.2# vim /etc/hosts
127.0.0.1       www.cpath.com

二、 配置apache 配置文件

/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

这里写图片描述

猜你喜欢

转载自blog.csdn.net/Cpath/article/details/79253781