Laravel The stream or file "/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied

user9250371 picture user9250371 · Jan 29, 2018 · Viewed 21.6k times · Source

I'm running Laravel app on server (Ubuntu 16.04). I have an error

The stream or file "/var/www/mydomain.com/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied

I've already google my question. I found this answer, but it wasn't helpful. I can't set 777 permission for storage (it's dangerous), as was suggested by many other answers I found.
Any other suggestions?


UPDATE:

sudo chgrp -R www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache

was helpful

Answer

user9250371 picture user9250371 · Feb 5, 2018

This commands were helpful:

sudo chgrp -R www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache