1. 打开终端,开启Apache:
//开启apache: sudo apachectl start
//重启apache: sudo apachectl restart
//关闭apache: sudo apachectl stop
回车会提示输入密码,也就是你电脑的密码,http://127.0.0.1/测试一下,成功则如下图:
2. 点击Finder,然后Command+Shift+G,前往如下路径(mac下Apache服务器的文件路径)
/Library/WebServer/Documents
3.修改Apache默认根路径
命令行 open /etc/apache2
修改httpd.conf中
# DocumentRoot "/Library/WebServer/Documents"
DocumentRoot "/Users/pengtao/pt/Apache-WEB"
<Directory "/Users/pengtao/pt/Apache-WEB">
重启服务器