nginx (engine X) – What a Pain in the BUM! [13: Permission denied]

The last 3-4 hours I’ve been struggling with nginx. Everything I did resulted in a “403 Forbidden” error.

Looking at the log files and eventually figuring out how to get more information into said log file I eventually came up with the following that was causing all the problems:

2008/07/22 13:29:31 [error] 3693#0: *1 open() "/var/www/site.com/public/img/bullet_purple.png" failed (13: Permission denied), client: 192.168.1.31, server: site.com, request: "GET /img/bullet_purple.png HTTP/1.1", host: "site.com"

All clever people will simply see this and go “oh that’s a file access permission error, lets see what the permissions are”. The nginx config says to run as nginx:nginx so therefore as long as that group is on the file with a read bit set that process should have access, right? WRONG! Changing the file permissions so it is
-rw-r--r-- 1 site nginx 9665 Jul 22 13:56 bullet_purple.png
does nothing, still permission denied.

If you change the user that nginx is running as to site:site – presto everything works! This seems completely opposite of what is suppose to happen. I can’t be assed looking into the issue though. Right now I just need the files served so I can do some work….