I also wrestled with this problem. Here's a basic solution to help point you in the right direction:
Step 1: find the default root folder of your web server
Step 2: give the user www-data full ownership of web server folder. (Use -R
to make change recursive.)
sudo chown -R www-data:www-data /path/to/webserver/root
Step 3: restart NGINX
sudo service nginx restart
Note: The above will solve your problem; though it exposes your server stack to number of potential vulnerabilities. Please check the links below for further info:
File Permissions
I strongly suggest you set permissions back to 755, to avoid any unnecessary security issues. Check out the Wordpress codex info on file permissions.
Linux permissions
Also, check the link below for further info on setting up users and groups. It provides a good breakdown of Linux permissions, privilege separation etc. Should cover all your needs...
You're definitely looking in the right area, the answer is much closer than you might think!