Apache的基本使用(Mac)

Mac下自带了Apache。

查看Apache版本

apachectl -v

启动Apache

sudo apachectl start

关闭Apache

sudo apachectl stop

重启Apache

sudo apachectl restart

通过浏览器访问 http://127.0.0.1/ ,可以看到内容为“It works!”的页面,即为启动成功。

安装目录

/etc/apache2/

默认根目录

/Library/WebServer/Documents

设置虚拟主机

配置hosts

sudo vi /etc/hosts
志遥 wechat
微信扫一扫,我在丁香园记公众号等你