【问题标题】:Access forbidden to folders in /Users/user/ on Monterey禁止访问 Monterey 上 /Users/user/ 中的文件夹
【发布时间】:2022-02-08 23:21:36
【问题描述】:

我正在尝试在带有 MacOs Monterey 的 Apple 硅 mac 上设置 nginx。

Nginx 已安装brew

如果我编辑配置文件 (/opt/homebrew/etc/nginx/nginx.conf) 以设置新的根目录,如果我将其指向与我的用户文件夹无关的文件夹,它就会起作用。例如

location / {
    root   /var/www/sites;
    index  index.html index.htm index.php;
}

但是,如果我将 root 设置为我的主目录中的文件夹,例如

location / {
    root   /Users/name/sites;
    index  index.html index.htm index.php;
}

我收到 403 禁止错误。

虽然这似乎是一种常见的设置,但很多教程都说将您的各种网站放在/User/username/Sites

我尝试使用chmod 755 sites 更改权限,并尝试将sites 目录的所有者更改为root 用户。然而,这些都没有奏效。我在尝试设置 apache 时遇到了类似的问题。

任何想法我做错了什么我的权限? nginx(和/或 apache)是否应该能够访问 /Users/user/.. 中的文件夹?

【问题讨论】:

    标签: nginx permissions homebrew macos-monterey


    【解决方案1】:

    user username staff; 添加到nginx.conf。这对我有用。不确定它是否有利于安全。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-08-03
      • 2011-08-25
      • 2016-08-28
      • 2015-02-17
      • 2017-07-06
      • 2016-11-11
      • 2016-08-03
      • 1970-01-01
      相关资源
      最近更新 更多