首页 > 解决方案 > 将我的“站点”文件夹与 iCloud Drive 同步?

问题描述

我担心我的本地主机文件,所以我想将它们与 iCloud Drive 同步。经过一些尝试后,我得到的http://localhost是 403 Forbidden 错误。

我已经尝试了我对我的~/Downloads文件夹所做的 - 只是用别名替换它~/Documents/Downloads,而 Documents 正在与 iCloud Drive 同步。但是对于~/Sites位于同一个“主”文件夹 ( ~/) 中的文件夹,它不起作用。

DocumentRoot "/Users/dafuqtor/Sites"
<Directory "/Users/dafuqtor/Sites">

这就是我的 localhost 目录httpd.conf现在的样子。但正如我上面所说,当我将 DocumentRoot 和 Directory 更改为 时"/Users/dafuqtor/Documents/Sites",我得到 403 试图访问http://localhost.

我已经调查过了/var/log/apache2/error_log。第一次,它说Cannot serve directory ... server-generated directory index forbidden by Options directive,所以我添加Options +Indexeshttpd.conf。现在,当我尝试访问 localhost 时,error_log 给了我这个:

access to / denied (filesystem path '/Users/dafuqtor/Documents/Sites') because search permissions are missing on a component of the path

标签: macosapache

解决方案


Apache 通常以 user 身份运行_www,并且~/Documents通常设置其权限,以便除其所有者(即 user dafuqtor)之外的任何人都可以访问它。

可以通过使用 chmod 来解决这个问题,让每个人至少在你的文档文件夹(chmod o+x ~/Documents)上执行权限,但我不特别推荐这样做;结合网络服务器,它似乎会引发错误,让您的整个文档目录向世界开放!


推荐阅读