【问题标题】:Adding a directory to Apache Server将目录添加到 Apache 服务器
【发布时间】:2014-03-08 15:35:04
【问题描述】:

我有一个运行 XAMPP/Apache 的 Windows XP 系统。我已经在外部硬盘驱动器上有文件,我想在不将它们移动到与 Apache 安装相同的驱动器的情况下提供这些文件。

这是我迄今为止尝试过的:

在主 HTTPD.conf 文件中:

别名 /client_files D:/clients/files

选项索引 FollowSymLinks 多视图

允许覆盖所有

   Order Allow,Deny
        Allow from all

目录>

但我得到的唯一结果是:

禁止访问!

您无权访问请求的对象。服务器要么读保护要么不可读。

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

错误 403

本地主机

Apache/2.4.7 (Win32) OpenSSL/1.0.1e PHP/5.5.6

我也尝试添加到 HTTPD-VHOSTS.conf 文件:

服务器名称 client_files

ServerAlias client_files

DocumentRoot "D:/clients/files"

还有:

ServerAdmin webmaster@dummy-host.example.com

DocumentRoot "D:/clients/files"

服务器名称 client_files

ServerAlias client_files

ErrorLog "logs/dummy-host.example.com-error.log"

CustomLog "logs/dummy-host.example.com-access.log" 常见

虚拟主机>

但这些都不起作用。到底如何才能将另一个目录添加到 Apache 安装并通过“localhost/client_files”之类的方式访问它?

有什么建议吗?

更新: [已解决]

根据下面@Pedro Nunes 的回答,我现在有我的 httpd.conf 文件,文件末尾有此部分,其中包括 Pedro 回答的“要求所有已授予”行,现在解决了问题:

别名 /client_files D:/clients/files

要求全部授予

选项索引 FollowSymLinks 多视图

允许覆盖所有

   Order Allow,Deny
        Allow from all

目录>

【问题讨论】:

  • 试试AllowOverride None
  • mm 也尝试将服务器名称添加到 windows 主机文件(指向 127.0.0.1)
  • 感谢您的建议,但没有奏效。我将“AllowOverride all”更改为“AllowOverride none”并重新启动 Apache,但它仍然无法正常工作。它仍然带来了 403 错误。

标签: apache xampp


【解决方案1】:

本指南准确地解释了我是如何在我的 windows xampp 机器上设置它的。 http://www.delanomaloney.com/2013/07/10/how-to-set-up-virtual-hosts-using-xampp/
请记住提供绝对的文档根路径以及将 127.0.0.1 servername 行添加到 C:/Windows/System32/drivers/etc/hosts 中的主机

【讨论】:

    【解决方案2】:

    您是否在目录部分尝试过Require all granted? 这将授予对所有请求的访问权限。

    【讨论】:

    • 优秀!这似乎已经做到了。我按照您的建议在“目录”部分下添加了“需要所有授权”行,重新启动 Apache,现在它似乎按预期工作。非常感谢。
    猜你喜欢
    • 2017-11-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-03-20
    • 2015-09-02
    • 2017-11-06
    相关资源
    最近更新 更多