【问题标题】:Connection to localhost fails与本地主机的连接失败
【发布时间】:2014-01-07 08:33:36
【问题描述】:

我设置 /etc/apache2/extra/httpd-vhosts.conf 如下:

# Ensure that Apache listens on port 80
Listen 80

# Listen for virtual host requests on all IP addresses
NameVirtualHost *:80

<VirtualHost *:80>
        ServerName localhost
        DocumentRoot /Library/WebServer/Documents/
</VirtualHost>

在 /Library/WebServer/Documents/ 中是标准 index.html.en 文件,在我将 httpd-vhosts.conf 包含到我的 httpd.conf 之前,它已在浏览器中完美显示。

使用 Chrome 和 Firefox 与本地主机的连接失败。设置是否正确?还有什么问题?

【问题讨论】:

  • apache 是否启动了?因为无法连接在我看来它会因配置错误而失败。
  • apachectl start 让我 org.apache.httpd:已经加载。所以我认为它开始了。我也重启了好几次。如果我不包括 httpd-vhosts.conf 一切都会像魅力一样。我还能寻找什么?

标签: apache localhost vhosts


【解决方案1】:

我解决了这个问题。我无法提供更多信息,因为我只是不知道在哪里可以找到问题所在。这篇文章让我走上了正确的道路:

http://macosx.com/forums/mac-os-x-system-mac-software/299851-apache-wont-start-up.html

sudo apachectl configtest

在 httpd.conf 文件中给了我一个语法错误。修复后一切正常。重要的是有机会运行配置测试。

【讨论】:

    猜你喜欢
    • 2018-08-31
    • 1970-01-01
    • 1970-01-01
    • 2016-05-16
    • 2021-11-27
    • 2017-12-24
    • 2018-02-10
    • 1970-01-01
    相关资源
    最近更新 更多