Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save masdimdev/1be68aea607228558ad5a7a21bd1f315 to your computer and use it in GitHub Desktop.

Select an option

Save masdimdev/1be68aea607228558ad5a7a21bd1f315 to your computer and use it in GitHub Desktop.

Revisions

  1. @agasigp agasigp created this gist Jan 9, 2018.
    21 changes: 21 additions & 0 deletions laravel-file-permission-apache.md
    Original 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)