XAMPP:访问root子目录中的html页面

时间:2017-02-04 09:03:40

标签: html windows apache xampp

这很可能是初学者的问题,但我似乎无法在任何地方找到解决方案,我发现处理它的几篇文章都没有答案(例如xampp in window 7 cannot access files in subfolder inside C:/xampp/htdocs)。

到目前为止,我有一个使用XAMPP的工作localhost(必须将端口更改为8080),位于自定义文档根目录中。我可以加载index.html,但是当我点击指向子目录的链接时:

#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>

我收到以下错误:

  

服务不可用!

     

由于服务器暂时无法为您的请求提供服务   维护停机或容量问题。请稍后再试。

     

如果您认为这是服务器错误,请与网站管理员联系。

     

错误503

     

localhost Apache / 2.4.25(Win32)OpenSSL / 1.0.2j PHP / 5.6.30

即使我直接在浏览器中输入地址(http://localhost:8080/examples/test.html),它也无效。

有人可以说明这是否有效?或者,如果我应该在apache配置文件中指定一些东西?

我还可以注意到,当我在浏览器中查看html文件(在localhost之外)时,无论页面在目录中的位置如何,页面都能正常工作并加载。谢谢你的帮助!

编辑: 这是我修改过的conf文件DocumentRoot部分:

{{1}}

2 个答案:

答案 0 :(得分:1)

主要是如果你在Windows上安装XAMPP它运行没有任何问题。只在窗户上发出问题的事情是许可。您可以通过右键单击htdocs文件夹解决该问题,然后转到安全选项卡并为所有人提供所有权限。

答案 1 :(得分:1)

事实证明这个问题是由于一个不幸的巧合阻止了一个子目录被调用,恰恰是“例子”...... 请参阅此page,其中讨论了该问题并提出了修复建议。

简而言之,您可以:

  1. 转到文件C:\ xampp \ apache \ conf \ extra \ httpd -ajp.conf 并添加一个“#”来注释掉冲突的行: ProxyPass / examples ajp://127.0.0.1:8009 / examples smax = 0 ttl = 60 retry = 5
  2. 或者只是以不同方式重命名“examples”目录(例如examples2)
相关问题