开发者

Safest way to set up webroot with permissions?

first time user of Ubuntu, setting up a web server and am confused on best practices. Should I set it up in var/www/site/public or in home somewhere?

What is the best way to grant permissions? This is what I'开发者_开发技巧ve 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

This way I could setup a group to add people to at a later date. Can't add files anywhere but in my user folder, I know that's not the right place and I'd like to start off doing everything correctly.


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 any new folders you create inside /var/www are also assigned the appropriate permissions.

By the way? Did you check out apache mod_userdir?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜