启动MacOS 本地服务

MacOS 自带Apatch服务器, 在浏览器输入 http://127.0.0.1/  出现it works,代表访问成功

一. 启动

启动

sudo apachectl start

重启

sudo apachectl restart

关闭

sudo apachectl stop

二.添加文件

将文件添加到该路径下, 在浏览中输入地址即可访问(如: http://127.0.0.1/PoweredByMacOSX.gif )

/Library/WebServer/Documents 

三.访问

1.本机访问

找到本机 IP 地址, 在本机safari中输入 http://10.198.44.51 即可访问和 http://127.0.0.1 一样的效果

2.其他电脑/手机访问

保证在同一局域网

参考: https://blog.csdn.net/lovechris00/article/details/79408705

原文地址:https://www.cnblogs.com/daxueshan/p/9982256.html