nginx 403 on osx

I’ve got nginx up and running (trying to replace my mamp stack with it) and I kept running into a 403 error regardless of configuration. Turns out this was due to a config error. In OSX, you need to specify a user:group in the nginx config file that match a user that has access to the files you want to serve.

For example, my computer’s user is mengel and my group is staff. My config file is as follows:

user mengel staff;
 
events {
    worker_connections 1024;
}
 
http {
    server {
        listen 80;
        server_name localhost;
        root    /Users/mengel/Documents/Workspace/localhost;
        location /{ 
           autoindex on;
           autoindex_exact_size off;
        }
    }
}