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

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.


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.


Never put anything system critical under /home. I say /var/www.

Edit: In response to Butthle's comment, which I concede is a fair criticism of my otherwise correct answer, emphasis mine:

FHS (Linux Filesystem Hierarchy v 2.3, Section 3.8) PDF Link

3.8. /home : User home directories (optional)

3.8.1. Purpose /home is a fairly standard concept, but it is clearly a site-specific filesystem.

The setup will differ from host to host. Therefore, no program should rely on this location.