为什么apache不从httpd.conf加载文档根目录

时间:2012-10-24 12:59:40

标签: macos apache httpd.conf

我在本地计算机上运行apache(Mac OS X)

侦听端口80:

Not Found

The requested URL /index.html was not found on this server.

Apache/2.2.22 (Unix) DAV/2 Server at localhost Port 80

我可以使用sudo apachectl -v stop停止服务器并重新启动它 但无法找到或更新文档根目录。

尝试了以下内容:

sudo apachectl -V | grep -i SERVER_CONFIG_FILE | cut -f2 -d'"' | xargs grep -i '^DocumentRoot' | cut -f2 -d'"'

从.conf文件中打印出文档根目录并返回:

DocumentRoot /var/empty
/Library/WebServer/Documents

尝试为要服务的Web服务器创建测试文件

echo 'Hello World1!' > /var/empty/index.html
echo 'Hello World2!' > /Library/WebServer/Documents/index.html

重新启动了apache,但“Hello World”仍未显示404页面。

1 个答案:

答案 0 :(得分:1)

系统偏好设置中的

网络共享选项 - >共享未启用

enter image description here

如果您遇到同样的问题,但您的共享面板没有“网络共享”选项,您可以尝试关注CLICKONTYLER blog post