Permission denied for Nginx even if www-data user has group write access

view story

http://serverfault.com – Nginx is not able to write to log file even if its user has write group access. Here are some details: www-data user is in ubuntu group: $ id www-data uid=33(www-data) gid=33(www-data) groups=33(www-data),1000(ubuntu) /opt/logs/ is group writable: $ ls -ld /opt/logs/ drwxrwxr-x 2 ubuntu ubuntu 4096 2012-07-27 02:47 /opt/logs/ www-data user can create /opt/logs/1 as expected: $ su www-data $ touch /opt/logs/1 $ ls -l /opt/logs/1 -rw-rw-r-- 1 www-data www-data 0 2012-07-27 02:47 /opt/logs/1 Nginx user:groups: var_dump(system('whoami'), system('groups')); // string 'www-data' (length=8 (HowTos)