I’m a newbie just kind of toying with setting up a web server. I found a tutorial that said to change ownership of a new domain’s directory to www-data:www-data but then I noticed the default directory was root:root.
So I now have these questions:
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
When a folder is “user:group” you are referring to the fact that the folder is owned by user “user” who belongs to group “group”. When a folder is created (in this case, /var/www), the ownership goes to the user who created it. When the VPS was created, it was created by the root user so the folders . You can change the ownership to www-data:www-data or you can change permissions to allow NGINX (or any program operating at www-data:www-data) certain permissions (which is a whole other topic in itself).
If you wanted to change ownership of the folder to www-data and pretty much give NGINX full access, open up the console and issue the command “chown www-data:www-data /var/www” (if you are the root user). If you aren’t the root user, you’ll need to prefix the above command with “sudo”.
If you wanted to change the permissions, that’s a much more in depth command but generally speaking, you use the command “chmod”. Google it and there are plenty of articles that will go into the permissions more in depth.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.