I had the similar error.
All recommendations didn't help.
The only replacement www-data with nginx has helped:
$ sudo chmod nginx:nginx /var/run/php/php7.2-fpm.sock
/var/www/php/fpm/pool.d/www.conf
user = nginx
group = nginx
...
listen.owner = nginx
listen.group = nginx
listen.mode = 0660