I have created a centos instance on digital ocean hosting multiple websites by setting up virtual host, all is working fine, however assigning correct directory permission for each website is bugging me and i could not find any relevant answer by searching, hence hoping someone here could lend me a helping hand, let me elaborate.
For the sake of explanation lets assume i am hosting a.com and b.com on my web server, i also created 2 users which is "user_a" and "user_b" and here is my directory structure for hosting the files
Directory #1 : /var/www/a.com/public_html Directory #2 : /var/www/b.com/public_html Directory#1 is assigned user_a by running the following command
sudo chown -R user_a:user_a /var/www/a.com/public_html Directory#2 is assigned user_b by running the following command
sudo chown -R user_b:user_b /var/www/b.com/public_html My issue is that Apache/PHP is running under the user www and when it tries uploading file using PHP it throws permission error, O assume it is because project directory is assigned a different user and Apache is running under different user (please correct me if i am wrong).
The easiest work-around is to reassign www user to project directory, however i am not sure if it is a security flaw, or i would like to know how to go with the user permission in such situation?
Thanks