Every time I install Apache to test a script, this question comes up for me. I don't do it very often, but I remember this being a pain point since about 2007.
A lot of tutorials/forums recommend using:
sudo chmod -R 777 /var/www/
But never mention that this is not for production or still recommend it even when the question specifies that the server will be public facing, but we don't want strangers able to write files to our server!
Another solution I found was to change the owner of the folder to your user, and then change the permissions:
sudo chgrp joe /var/www/html sudo chmod 775 /var/www/html sudo chown -R joe /var/www/html/*
But having ownership of publicly available and executing files strikes me as a bad practice, not to mention all files we might create in this directory will be owned by our user.
What are the implications of these and other bad practices? What are the correct ways to set up the users/permissions of a publicly facing web-server?