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/..?