XAMPP:访问根目录下的html页面



这很可能是初学者的问题,但我似乎在任何地方都找不到修复方法,而且我发现的几篇关于它的帖子都没有得到回复(例如,窗口7中的examplep无法访问C:\examplep/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>

事实证明,这个问题是由于一个不幸的巧合导致子目录无法被调用,确切地说,是"examples"。。。请参阅本页,其中讨论了该问题并提出了解决方案。

简而言之,您可以:

  1. 或者转到文件C:\examplep\apache\conf\extra\httpd-ajp.conf并添加一个"#"以注释掉冲突的行:ProxyPass/示例ajp://127.0.0.1:8009/examplessmax=0 ttl=60重试=5
  2. 或者简单地以不同的方式重命名"examples"目录(例如examples2)

大多数情况下,如果在windows上安装XAMPP,它运行时不会出现任何问题。在windows上唯一会引起问题的是权限。您可以通过右键单击htdocs文件夹并转到安全选项卡并将所有权限授予每个人来解决此问题。

最新更新