Apparently, for some strange reasons, having the same permission rights on the temp folder and on storage was not enough. Following the guide I found here, I set the rights for all the folders to root as owner and to www-data as group. This is enough for livewire temp folder but seems not to the storage folder. At least not for livewire, because laravel is correctly able to write on the storage folder with this configuration.
Anyway, as soon as I changed the owner of storage folder to www-data, everything started working. The strange thing is that I never received a permission denied error.