Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kazi-shahin/17fa7b42b9902f953ffe1e56c68affcb to your computer and use it in GitHub Desktop.
Save kazi-shahin/17fa7b42b9902f953ffe1e56c68affcb to your computer and use it in GitHub Desktop.
Laravel file permission on apache

Laravel File Permission on Apache

  1. 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
  1. Add user to the webserver user group
sudo usermod -a -G www-data ubuntu
  1. 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 {} \;
  1. 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment