修改 Apache 配置文件 (Windows) 后无法连接到本地主机



我已经下载了适用于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

在我的设置中,是否有一些我错过的明显的东西?

谢谢

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

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

首先,确保您能够访问http://localhost/

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

如此处的示例中所述。请在下面尝试。

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

祝你好运!

最新更新