Mac自带的本地服务器的使用

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

在步骤1中只输入一个http://127.0.0.1其实默认打开的是index.html.en(html是一个网页文件),该文件的内容就是在步骤1中测试时浏览器所显示的内容.


此时如果我在浏览器的网址框输入的是http://127.0.0.1/PoweredByMacOSX.gif, 浏览器就便会显示PoweredByMacOSXLarge.gif图片.

3. 使用过后,记得关闭服务器,要不然会一直消耗你电脑内存,后果你懂的。

posted on 2017-06-04 16:12  cc_ccc  阅读(9856)  评论(0编辑  收藏  举报