【发布时间】: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