Welcome! Log In Create A New Profile

Advanced

Set Permissions on Nginx html folder?

Posted by robertf57 
Set Permissions on Nginx html folder?
October 20, 2011 10:52PM
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!
Re: Set Permissions on Nginx html folder?
October 24, 2011 01:58PM
what user you have in your nginx.conf? thats the user that should own your html folder.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 211
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready