1、mac本身自带apache服务器,只需要修改3个文件的配置即可2、打开finder前往文件夹 输入/etc 找到apache2文件夹下的httpd.conf
修改文件中的代码为 #AllowOverride none #Require all denied #2017-05-26 Require all granted AllowOverride all AllowOverride all Allow from allInclude /private/etc/apache2/extra/httpd-vhosts.conf注:找到这行代码 把注释取消掉3、在apache2 中extra文件夹下打开httpd-vhosts.conf
修改文件中的代码为 #ServerAdmin webmaster@mysite.local DocumentRoot "/Users/xiekai/xn/" ServerName w.xn.com ServerAlias www.dummy-host.example.com ErrorLog "/private/var/log/apache2/dummy-host.example.com-error_log" CustomLog "/private/var/log/apache2/dummy-host.example.com-access_log" common #DocumentRoot "/Users/teenker/xiekai/dev/" #ServerName w.www.xiekai.com <Directory /Users/xiekai/xn/> Options All Allow from All AllowOverride All </Directory>4、在etc文件夹下打开hosts文件修改如下
127.0.0.1 w.xn.com //自己配的地址255.255.255.255 broadcasthost::1 localhost0.0.0.0 account.jetbrains.com5、sudo apachectl restart 重启服务即可 或者重启电脑
网上资料 http://blog.csdn.net/simplty/article/details/43021375
