'Access forbidden to folders in /Users/user/ on Monterey
I am trying to setup nginx on an Apple silicon mac with MacOs Monterey.
Nginx has been installed with brew
If I edit the config file (/opt/homebrew/etc/nginx/nginx.conf) to set a new root directory, it works if I point it at a folder that is not associated with my user folder. For example
location / {
root /var/www/sites;
index index.html index.htm index.php;
}
However, if I set root to a folder in my home directory, e.g
location / {
root /Users/name/sites;
index index.html index.htm index.php;
}
I get a 403 Forbidden error.
Although this seems to be a common setup, lots of tutorials say to put your various sites in /User/username/Sites.
I've tried changing the permissions with chmod 755 sites and I've tried changing the owner of the sites directory to the root user. However none of these worked. I had similar issue when trying to setup apache.
Any ideas what I'm doing wrong with my permissions? Should nginx (and/or apache) be able to access folders in /Users/user/..?
Solution 1:[1]
Add user username staff; to nginx.conf. That worked for me. Not sure it is good for security.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | vvkatwss vvkatwss |
