In my Laravel app, I am using Nginx as the server. Ubuntu version is 21.10
I also want to use Laravel's console (Tinker) to log stuff. When I set www-data to be the owner of storage folder, which contains the logs, then I can view my app via localhost, but then I can't use Tinker to log information, for example Log::debug("test");, as I get:
UnexpectedValueException with message 'The stream or file
"/var/www/laravel-app/storage/logs/laravel.log" could not be
opened in append mode: Failed to open stream: Permission denied
so I set my user temporarily to own storage when I want to use Tinker:
sudo chown -R $USER:www-data storage
But then I can't view my app, as I get the same error as above when trying to access localhost.
How can I make both users have permissions to stoarge?