6

There are a million questions like this on Google, but I haven't found a solution to my problem. The default Apache install on my Mac is giving 403 Forbidden errors for everything (default directory, user home directory, virtual server, etc). After sifting through the config files, I figured I'd give nginx a try.

Nginx serves files fine from it's home directory, but it won't serve files from a subfolder of my user directory. I've configured a simple virtual host, and requesting index.html returns a 403-forbidden.

The error message in nginx's log file is pretty clear - it can't read the file:

2011/01/04 16:13:54 [error] 96440#0: *11 open() "/Users/me/Documents/workspace/mobile/index.html" failed (13: Permission denied), client: 127.0.0.1, server: local.test.com, request: "GET /index.html HTTP/1.1", host: "local.test.com"

I've opened up this directory to everyone:

drwxrwxrwx   6 me  admin     204B Dec 31 20:49 mobile

And all the files in it:

$ ls -lah mobile/
total 24
drwxrwxrwx   6 me  admin     204B Dec 31 20:49 .
drwxr-xr-x  71 me  me   2.4K Dec 31 20:41 ..
-rw-r--r--@  1 me  me   6.0K Jan  2 18:58 .DS_Store
-rwxrwxrwx   1 me  admin     2.1K Jan  4 14:22 index.html
drwxrwxrwx   5 me  admin     170B Dec 31 20:45 nbproject
drwxrwxrwx   5 me  admin     170B Jan  2 18:58 script

And yet, I cannot figure out why the nginx process cannot read index.html. It's running as the "nobody" user, but the permissions are set such that anyone can read them.

1 Answer 1

9

What are the permissions on /Users/me, /Users/me/Documents and /Users/me/Documents/workspace? All of the folders in the tree need to be readable by the nobody user.

3
  • This fixed it, thank you so much. It also reveals a fundamental misunderstanding I had about file permissions.
    – Tom Lianza
    Jan 4, 2011 at 15:55
  • If you do that you are exposing all the users docs, aren't you? Jun 13, 2014 at 17:58
  • No, making the directories readable by nobody doesn't mean that you've made the files in the directories readable.
    – Mike Scott
    Jun 13, 2014 at 20:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.