apache - 使用 Apache 修复别名目录上的 403 Forbidden

标签 apache macos permissions operating-system alias

我正在尝试设置一个别名来指向我的文件系统上不在 DocumentRoot 中的某个目录。现在我收到 403 Forbidden 响应。以下是采取的步骤: 1.编辑http.conf,添加:

Alias /example "/Users/user/Documents/example"

然后...

<Directory "/Users/user/Documents/example">
   Options Indexes FollowSymLinks MultiViews
   AllowOverride None
   Order allow,deny
   Allow from all</Directory>

2.在终端中使用 chmod 设置权限:

chmod 755 /Users/user/Documents/example

现在应该可以工作了吧?相反,我的访问被禁止。这是 error_log 的输出:

[Sun Jul 24 06:57:57 2011] [error] [client xx.xx.xx.xx] (13)Permission denied: access to /example denied

最佳答案

我在 OS X 上也遇到了这个问题。原来是gliptak是对的,但我还有一些细节需要补充。

我们都尝试为用户主文件夹下的文件夹配置虚拟目录;我认为这就是我们遇到问题的原因。就我而言,我有以下设置:

  • 主文件夹为 /Users/calrion
  • 虚拟目录文件夹为 /Users/calrion/Path/to/www
  • 有一个符号链接(symbolic link) /Users/calrion/Path 指向 /Volumes/Other/Users/calrion/Path

问题是用户和组 _www(Apache 在 OS X 上运行)缺乏对 /Users/calrion/Volumes/Other 的执行访问权限/Users/calrion.

运行 chmod o+x/Users/calrionchmod o+x/Volumes/Other/Users/calrion 解决了该问题(在 OS X 10.7.4 上) .

此处的规则是,Apache 需要对路径中的所有文件夹进行执行访问才能提供文件。如果没有这个,您将收到 HTTP 403(禁止)。

关于apache - 使用 Apache 修复别名目录上的 403 Forbidden,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6807317/

相关文章:

ruby - 获取 libxml2.2.dylib "file is not of required architecture"错误

ios - 在 FB.com 上删除应用程序后,FB 应用程序无法向 iOS 请求权限

heroku - PG :InsufficientPrivilege: ERROR when trying to make an INSERT on stage database

apache - 如何使用 SSL 创建用于本地开发的证书?

c - 在 Windows 上,C 的二进制写入模式出错?

java - 无法启动 .jar 文件(使用 LWJGL)

session - Laravel 7 : How to clear withErrors session

PHP - 非破坏性输入清理

php - Wordpress:413 请求实体太大

c - MacOS : Scheduler affinity seems not to work