Write permission issues when updating from 10.0.1 to 10.0.2

I had exactly the same problem when I went to update from 11.0.1 to 11.0.2 ( apache2 ).
Me too solved the problem of permissions, executing :
sudo shown -R www-data:www-data /var/www/Nextcloud_Dir
but it is the right way ?

The right is to follow these permissions , correctly ?