Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Accepted Answer
I realize this is an old post, but it is one of the top search results on Google and I don’t feel like it has been adequately answered anywhere (lots of meandering to getting to the point). So I wrote a blog post on the topic:
http://cubicspot.blogspot.com/2017/05/secure-web-server-permissions-that-just.html
To summarize, the best balance between security and usability is to make the web root owned by root, create and assign a specific group to the web root, chmod 775 the web root, chmod g+s on the web root, and assign all users who need to edit files to the newly created group.
addgroup sftp-users
adduser youruser sftp-users
adduser anotheruser sftp-users
chown root /var/www
chgrp sftp-users /var/www
chmod 775 /var/www
chmod g+s /var/www
The g+s sets the “sticky bit” for the group, which correctly propagates the group and the permissions to all files (they’ll be 664) and directories (775) as they are created. The number of directories that need ‘www-data’ as the owner should be kept to a bare minimum.
I’m new in Digital Ocean and I successfully created droplet and set up an apache2 server I uploaded all my website files in var/www/html folder but while accessing my website I am getting " This Page isn’t working error" Droplet IP -139.59.56.242