Warning
Use a sudo-capable account, keep shell history for audit, and back up critical paths before changing boot, SSH, or package state.
What you will achieve
Read and fix permission denied errors without chmod 777 everything like a maniac.
1) Inspect ownership and mode
ls -l /var/www
namei -l /var/www/html/index.html
2) Apply correct owner/group
sudo chown -R www-data:www-data /var/www/html
3) Apply sane permission defaults
find /var/www/html -type d -exec chmod 755 {} \;
find /var/www/html -type f -exec chmod 644 {} \;