Forked from agasigp/laravel-file-permission-apache.md
Created
January 9, 2018 04:14
-
-
Save masdimdev/1be68aea607228558ad5a7a21bd1f315 to your computer and use it in GitHub Desktop.
Revisions
-
agasigp created this gist
Jan 9, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ # Laravel File Permission on Apache 1. Set the owner & group of file & folder to apache user (**www-data**) ```bash sudo chown -R www-data:www-data /path/to/your/root/directory sudo chown -R www-data:www-data /path/to/your/root/directory ``` 2. Add user to the webserver user group ```bash sudo usermod -a -G www-data ubuntu ``` 3. Set file & directory permission to **775** & **644** ```bash sudo find /path/to/your/root/directory -type f -exec chmod 644 {} \; sudo find /path/to/your/root/directory -type d -exec chmod 775 {} \; ``` 4. Vive read and write permissions to the webserver for storage, cache and any other directories the webserver needs to upload or write too ```bash 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](https://laracasts.com/discuss/channels/general-discussion/laravel-framework-file-permission-security)