1. 程式人生 > >mac 本地配置域名訪問專案

mac 本地配置域名訪問專案

一、 新增虛擬域名

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

這裡寫圖片描述