I'm setting up a brand new RHEL/Apache installation. Should the DocumentRoot (webpage files) be /var/www/html or /home/httpd. I've noticed both directories and am unsure which is more appropriate.
/var/www/html is where stuff should go. /home/httpd is a very legacy location that was a default in the apache 1.x days but most software, any RPM packages you install, etc. will presume that your webroot is under /var/www. Also the default SELinux rules tag files under /var/www automatically by default which should make management simpler for you by not going against the grain.
The main difference will be how your disks are partitioned.
- If you want a /home partition that's, say, on a RAID or is backed-up regularly, you may want to put your website's data on that partition.
- If your /var is on a RAID or being backed-up regularly, independently from /home, then maybe you want your website's data on /var instead, especially if you have other vital services that have their data sit on /var (like bind, postfix, cyrus, databases, etc.).
- If you don't backup anything and just have /home and /var on separate partitions, it's a matter of keeping user data separate (/home) from system data (/var).
- If you have both /home and /var on the same partition, then it doesn't really matter.
Both paths are good options but not mandatory.
The de facto standard is /var/www for the server and /home/users* if userdir_mod is enabled.
But I don't use its, allow me to explain :)
The Filesystem Hierarchy Standard describe:
/var contains variable data files. This includes spool directories and files, administrative and logging data, and transient and temporary files.
/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.
/srv contains site-specific data which is served by this system.
I leave /var/www for the default VirtualHost, with a fantastic It works! page or a redirection.
And the other VirtualHost DocumentRoot points to
Generaly /srv/nameserver/cli/customernumber is the mount point of a hard disk partition owned by the customer, local or NFS, and if the customer don't need to execute cgi's, I mount with noexec options in the fstab, i.e.:
LABEL=c128 /srv/cli/c128 ext4 rw,noexec,nosuid 0 2