- Set the owner & group of file & folder to apache user (www-data)
sudo chown -R www-data:www-data /path/to/your/root/directory
sudo chown -R www-data:www-data /path/to/your/root/directory
- Add user to the webserver user group
sudo usermod -a -G www-data ubuntu
- Set file & directory permission to 775 & 644
sudo find /path/to/your/root/directory -type f -exec chmod 644 {} \;
sudo find /path/to/your/root/directory -type d -exec chmod 775 {} \;
- Vive read and write permissions to the webserver for storage, cache and any other directories the webserver needs to upload or write too
sudo chgrp -R www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache
Source : https://laracasts.com/discuss/channels/general-discussion/laravel-framework-file-permission-security