Centos – Where to put Web Root in CentOS? /var/www/ or /home/user/public_html/

centosweb-server

Our old server has it in /home/user/public_html/ but it seems like it makes more sense in /var/www/.

The old server had cpanel and I suppose that as part of that setup, it separates virtual servers into their own folders in /home/ and gives them each a web root. All the files in /home/user/ were also owned by user, rather than root.

But we don't have sub accounts and I'm used to creating various virtual hosts in /var/www/ (from my Ubuntu experience), so is there any downside to just using /var/www/ in CentOS? I would then have all the files owned by a group that would include me and the other developer.

Best Answer

I don't see any difference. Put it in /var/www or /home/USER/www with the same owner has strictly the same security level.

However the question is confusing: you don't have sub accounts, but you do have vhost and other developers. Those developers share the same account with you, or each have one account in the same group? It is hard to manage in this case. I think you would need a deployment system: developers work with git/subversion, and in the server, you use a tool (it could just be a simple shell script doing svn up or git pull) so that all files for those web apps are under the unique user.