Mac上搭建Web服务器--Apache

局域网搭建 Web 服务器测试环境,因为Mac OS X 自带了 Apache 和 PHP 环境,我们只需要简单的启动它就行了。

1.命令:sudo apachectl start

Apache服务器默认的web根目录在:/Library/WebServer/Documents
Apache的配置文件在:/etc/apache2

相关命令:

停止 Apache:sudo apachectl stop

重启 Apache:sudo apachectl restart

2.浏览器输入:http://localhost



3.将一个html文件拷贝到/Library/WebServer/Documents 文件夹下


4.浏览器中访问,测试文件名为test.html的文件,格式:本机IP/静态网页,http://192.168.1.112/test.html

查看IP地址:偏好设置-->网络


原文地址:https://www.cnblogs.com/Free-Thinker/p/10950771.html