【问题标题】:Unable to connect to local host after modifying Apache config file (Windows)修改 Apache 配置文件后无法连接到本地主机 (Windows)
【发布时间】:2014-12-23 15:06:34
【问题描述】:

我已经下载并安装了 Windows 的 Apache HTTP 服务器。我在C:/mobileTraining/core/workspace/TestProject下创建了一个测试html文件 然后我在httpd.conf 文件中添加了一个权限目录标签,现在它看起来如下所示:

<Directory />
    AllowOverride none
    Require all denied
</Directory>
<Directory C:/mobileTraining/core/workspace>
    Order allow,deny
    Allow from all
</Directory>
Alias /TestProject C:/mobileTraining/core/workspace/TestProject

我已经尝试过使用和不使用第一个 Directory 标记,它已经存在。

当我保存这些更改并在我的浏览器中转到 http://localhost/TestProject/TestPage.html(我尝试过 Firefox 和 Chrome)时,我收到了连接错误。这是来自 Chrome:

This webpage is not available
Google Chrome's connection attempt to localhost was rejected. The website may be down, or your network may not be properly configured.
Error code: ERR_CONNECTION_REFUSED

在我的设置中是否有一些我遗漏的明显的东西?

谢谢

【问题讨论】:

  • 你重启服务了吗?
  • 我查看了我的 Apache 服务监视器,没有要重新启动的服务。这通常是怎么做的?

标签: windows apache localhost configuration-files httpserver


【解决方案1】:

尝试通过包含默认设置为 8080 的端口来访问您的站点

http://localhost:8080/TestProject/TestPage.html

【讨论】:

  • 我尝试了您建议的链接,但没有成功。如何检查 8080 是否与我的端口号相同?谢谢。
  • 您将能够在您安装Tomcat的conf目录下的server.xml文件中找到...\Tomcat 7.0\conf\server.xml。查找标签如下
【解决方案2】:

首先,确保您可以访问http://localhost/

另外,我想你在C:/mobileTraining/core/workspace/TestProject 中有TestPage.html 您正在为C:/mobileTraining/core/workspace 设置权限?

Example here 中所述。试试下面。

Alias /TestProject "C:/mobileTraining/core/workspace/TestProject"

<Directory "C:/mobileTraining/core/workspace/TestProject">
   Order allow,deny
   Allow from all
</Directory>

祝你好运!

【讨论】:

  • 谢谢斜线。我也无法访问 localhost,我认为这是主要问题。你还有其他我应该采取的步骤来解决这个问题吗?我有 TestPage.html 是那个文件夹是的。为该目录设置权限是什么意思?这不是我们对目录标签所做的吗?
  • 您在目录TestProject 中有TestPage.html,并且您正在为目录标签中的workspace 设置权限。从来没有尝试过,所以不确定它是否有效。请注意在示例链接中如何使用别名和目录。运行 httpd -t 命令以查找 conf 文件中的任何语法错误。此外,请检查您的 error.log 是否有任何特定错误。如果有帮助,请考虑投票。
猜你喜欢
  • 2015-08-28
  • 2013-01-16
  • 2014-11-06
  • 2023-02-03
  • 2016-01-01
  • 2021-06-20
  • 2015-07-26
  • 2015-11-04
相关资源
最近更新 更多