【发布时间】:2017-06-21 15:57:21
【问题描述】:
这很可能是初学者的问题,但我似乎无法在任何地方找到解决方法,而且我发现处理它的几篇帖子都没有得到答复(例如 xampp in window 7 cannot access files in subfolder inside C:/xampp/htdocs)。
到目前为止,我有一个使用 XAMPP 的本地主机(必须将端口更改为 8080),位于自定义文档根目录中。我可以加载 index.html,但是当我单击指向子目录的链接时:
<li><a href="examples/test.html"></a></li>
我收到以下错误:
服务不可用!
由于以下原因,服务器暂时无法处理您的请求 维护停机时间或容量问题。请稍后再试。
如果您认为这是服务器错误,请联系网站管理员。
错误 503
localhost Apache/2.4.25 (Win32) OpenSSL/1.0.2j PHP/5.6.30
即使我直接在浏览器中输入地址(http://localhost:8080/examples/test.html)也不起作用。
有人可以指出这是否应该工作吗?或者如果我应该在 apache 配置文件中指定一些东西?
我还可以注意到,在我的浏览器(本地主机之外)中简单地查看 html 文件时,无论它们在目录中的位置如何,页面都可以正常工作并加载。感谢您的帮助!
编辑: 这是我修改后的 conf 文件 DocumentRoot 部分:
#DocumentRoot "F:/Apps/xampp/htdocs"
DocumentRoot "F:/me/GitWorkDir/myproject_io"
<Directory "F:/me/GitWorkDir/myproject_io">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks Includes ExecCGI
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
AllowOverride All
#
# Controls who can get stuff from this server.
#
Require all granted
</Directory>
【问题讨论】:
-
你对conf文件中的documentRoot做了什么修改???
-
是的,我确实更改了 DocumentRoot 目录(请参阅原始帖子中的编辑)。这能解释这个问题吗?因为据我所知,即使在新的根目录下,本地主机也可以访问 index.html,只是不能在子目录中。