mac apache 配置虚拟域名


 配置HOSTS

 

 #vim /private/etc/hosts

 

  添加↓:

 

   127.0.0.1       tp.zhy.cn

 

 配置虚拟主机

 #vim /private/etc/apache2/extra/httpd-vhosts.conf

 

 添加↓:

 <VirtualHost *:80>

    ServerAdmin xxx@qq.com

    DocumentRoot "/Users/zhy/Sites/xxxx_5/public/"

    ServerName tp.zhy.cn

    ErrorLog "/private/var/log/apache2/xx.cn-error_log"

    CustomLog "/private/var/log/apache2/xx.cn-access_log" common

 </VirtualHost>

 

 

最后重启 apache ↓

 

 

重启Mac上的Apache服务

这个命令很早以前就查过了,但是每次使用的时候还是要在网上查:

停止服务:sudo /usr/sbin/apachectl stop

开启服务:sudo /usr/sbin/apachectl start

重启服务:sudo /usr/sbin/apachectl restart


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM