I'm new to nginx and have successfully installed nginx to my /opt/nginx directory. Nginx runs as user "nginx". My problem is that I can't write files to the /opt/nginx/html directory under my login account. The html directory's initial owner:group was root:root with permissions 755. I added my login name as well as the nginx login name to the "www-data" group and then ran the following commands:
chgrp -R www-data /opt/nginx/html
chmod -R g+w /opt/nginx/html
find /opt/nginx/html -type d -exec chmod g+s {} \;
However, I still can't write to the html directory under my login. I suspect the reason for this is that the parent directories, /opt and /opt/nginx, are both still owned by root:root with perms 755. I'm not in the root group and that group doesn't have write permission anyway. Now I could perform the same chgrp and chmod commands on these two higher-level directories as I did on the html sub-directory but that doesn't feel like the right solution. Specifically, it doesn't feel right to have /opt be assigned to the www-data group.
What is the correct (and secure) way to configure permissions on nginx's web root folder (html) so that a developer can upload files into that folder? I've looked on the nginx wiki and done numerous web searches but I haven't seen this specific problem addressed.
Thanks in advance for all responses!