If vhosts are enabled, where should I place my website files?
the systems is CentOS 6.x/RHEL 6.x,SELinux enabled.
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
For apache it doesn't matter, you simply define a DocumentRoot pointing to the directory where the files are.
From a practical perspective it might be good to follow the conventions of the distribution you're using, as things like SELinux and possibly AppArmor may have default policies that require modification when Apache is pointed to non-default locations.
If you mean where should you place the files for apache to be able to access them, then...
It's entirely up to you where you place your files. You configure your vhost to use whatever path you choose to use using the
As well as the normal Discretionary Access Control settings (users and groups), depending on your distro, you may need to reconfigure Mandatory Access Control (SELinux or AppArmor etc) to allow apache read or read/write access to the documents.
Apache itself doesn't care — it uses whatever you write in your vhost configuration. However the administrators of the machine care: you should follow conventions. If you don't follow the usual convention, you may have a hard time with package managers.
/home is supposed to belong to a particular user. This is not normally appropriate for the content of a website.
/usr is meant for installed programs. It doesn't change except when you install or upgrade programs. Don't put a web root there.
The two normal locations for web server roots are: