1sudo chmod -R 777 path/to/root
2sudo chown -R www-data:www-data /path/to/root
3sudo usermod -a -G www-data ubuntu
4sudo find /path/to/root -type f -exec chmod 644 {} \;
5sudo find /path/to/root -type d -exec chmod 755 {} \;
6sudo chgrp -R www-data storage bootstrap/cache
7sudo chmod -R ug+rwx storage bootstrap/cache