The ‘www-data’ is the default user of Nginx and Apache servers on Ubuntu system. That’s why when we need to serve some files or CMS with Nginx we change the ownership of the folder to:
www-data:www-data
If you are wondering why there’s 2 ‘www-data’ separated by colon, it’s because first is the username and second is group with the same title which is also the default of servers like Nginx and Apache.
So you usually do something like this:
chown -R www-data:www-data /var/www/mySite/wordpress
in order to grant full access to ‘www-data’ user of ‘www-data’ group so that Nginx has full access to files.
‘-R’ just means that process is done recursively and all inner directories are affected.
You can always see owners of the directory by:
ls -l
And if you just created the folder, it should look like this:
As you can see it’s owned by ‘nobody’ from ‘nogroup’. In this case if you forget to assign the right user and group, your app simply won’t work because your server like NGINX won’t have access to the files.