I have a laravel website setup and running on a Debian 10 server with PHP-FPM 7.3 and also Nginx
The fpm user in the config is www-data the nginx user in nginx.conf is also www-data
I have set permissions on storage like chmod -R 777 ./storage
and chown'd with chown -R www-data:www-data ./storage
When I monitor the logs Im seeing sessions being written as root and only root perms and the logs reporting this issue a lot
[2020-04-29 18:57:57] production.ERROR: file_put_contents(/var/www/html/storage/framework/sessions/FxzelAW8uGvV4mTUDJXo8aHCE56xjKHS5L7y2xsn): failed to open stream: Permission denied {"exception":"[object] (ErrorException(code: 0): file_put_contents(/var/www/html/storage/framework/sessions/FxzelAW8uGvV4mTUDJXo8aHCE56xjKHS5L7y2xsn): failed to open stream: Permission denied at /var/www/html/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:122)
doing ls -la on the storage dir yields the following:
drwxrwxrwx 3 www-data www-data 4096 Apr 24 13:26 app
drwxrwxrwx 2 www-data www-data 32768 Apr 25 09:08 debugbar
drwxrwxrwx 6 www-data www-data 4096 Apr 24 13:26 framework
drwxrwxrwx 2 www-data www-data 4096 Apr 29 00:01 logs