Apache user permission settings – very useful!
# Set ownership to web user
sudo chown -R ${USER}:www-data /var/www
# Change all files read write to user and group
find /var/www -type f -exec chmod 0660 {} \;
# Change all directories to read write execute attributes
# AND setting the sticky bit to 2 results in this happening
# only to directories
sudo find /var/www -type d -exec chmod 2770 {} \;
This link explains well and I like it!
Permissions for web