【问题标题】:Why apache does not load document root from httpd.conf [closed]为什么 apache 不从 httpd.conf 加载文档根目录 [关闭]
【发布时间】:2012-10-14 12:34:27
【问题描述】:

我在本地机器上运行 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 页面。

【问题讨论】:

    标签: macos apache httpd.conf


    【解决方案1】:

    系统偏好设置中的网络共享选项 -> 共享未启用

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

    【讨论】:

    • 网络共享选项不在系统偏好设置/共享/
    • 被山狮带走
    猜你喜欢
    • 2017-03-09
    • 2020-09-24
    • 1970-01-01
    • 1970-01-01
    • 2015-01-28
    • 2012-05-03
    • 1970-01-01
    • 2016-06-21
    • 1970-01-01
    相关资源
    最近更新 更多