Linux always may give you troubles with permissions so i will show you few command lines what can help you in this situation:
1)Create a group www-data
sudo addgroup www-data
2) Add user nginx in group www-data
sudo adduser nginx groupname
Add an existing user nginx to group www-data
usermod -a -G www-data nginx
3) Set group www-data to folder /var/www
sudo chown -R "$USER":www-data /var/www
4) Set permisions to all the folders from /var/www to 0755
sudo find /var/www -type d -exec chmod 755 {} \;
5) Set permision to all the files from directory /var/www to 0664 -this need for security reasons
find /var/www -type f -exec chmod 664 {} \;