You may want to make root or another user the owner of your web content. This will prevent the web server from overwriting content if someone gains access via a script or other entry point. Replace root
in these commands with whatever user you want to own the content.
chown -R root:www-data /var/www
chmod 2750 /var/www
To allow the user
(other than root) to maintain the content you will need to add the user to the www-data group.
adduser user www-data
Some web applications may have some directories where they write dynamic content. To allow access either change the owner to www-data or allow group write.