The safest way to configure webroot with permissions?

The first Ubuntu user to create a web server and get confused with best practices. Should I configure it in var / www / site / public or somewhere else?

What is the best way to grant permissions? This is what I found:

sudo adduser www-data (yourgroup) sudo chgrp (your group) /var/www sudo chmod –R 775 /var/www ***( or would 774 be better)*** sudo chmod g+s /var/www 

That way, I could set up a group to add people at a later date. It is not possible to add files anywhere, but in my user folder, I know that this is not the right place and I would like to start everything correctly.

+4
source share
1 answer
 sudo chown -R :www-data /var/www # make sure the folder is owned by group www-data sudo chmod g+w /var/www # grant write permission to group www-data on /var/www sudo adduser NEWUSER www-data # add NEWUSER to group www-data with write permissions in /var/www 

Make sure that all new folders created inside /var/www are also assigned the appropriate permissions.

By the way? Have you checked apache mod_userdir ?
+4
source

Source: https://habr.com/ru/post/1347416/


All Articles