Take care of ownership:

chown -hR www-data:www-data /var/www

Ensure the group can read and write the files. This does not enable it to alter any permissions though:

chmod  -R g+rw /var/www

The x bit. Ensure the group is permitted to list the directories, but not to execute the files:

find /var/www -type d -ls -exec chmod g+x {} ';'

Add yourself to the group www-data so you can use the permissions of this group:

usermod -aG www-data your-user        

The owner of the files does not have be www-data for apache to work well. The requirement is that the apache server which runs as www-data must be able to read the files. Most systems default to allowing group read access, so having the group on the files be www-data is sufficient.

The apache server needs to be able to write dynamic content such as wikis, content upload directories, and caches. Otherwise it is more secure to prevent the apache server from writing its content directories and files.

Consider changing the ownership to the user who needs to modify the content. Add them to the group www-data. You could also set the group sticky bit on the /var/www directory. If you are the user you can execute these commands.

sudo chmod g+s /var/www
sudo usermod -aG www-data $LOGNAME
sudo chown -R $LOGNAME /var/www

Logout and login again to gain access to the www-data group. You will then be able to modify the content.