Laravel proper permissions

This will work, as777 is a security risk

 sudo chmod -R o+w storage/

 sudo chmod -R 775 storage/

First, check the user assigned in Nginx www conf file /etc/php/7.0/php-fpm.d/www.conf
User may be www-data or _www or any other.

Then change the ownership of the project folder as

sudo chown $USER:www-data -R ~/Laravel/PBlog/

Then Change the file permissions as

sudo chmod u=+srwX,g=+srX,o=rX -R ~/Laravel/PBlog/

s flag means, any file/folder added/created inside the folder will take same permission.


Depending on how you bootstrapped your project, there is already a 775 flag on the storage folder usually, another easy fix, is to add your web server user to your group using usermod with the -aG options : usermod -aG $USER www-data