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.

  • Say I move /var/www to /www and bind mount /www in /var/www. This should work just the same, correct? – Stephen M. Harris Aug 31 '11 at 18:46
  • Sure that would be fine but just be sure you know what you are getting out of doing that. If you make a new filesystem and mount it under both /www and /var/www what does having the other directory name get you. If /www and /var/www are on the same filesystem what does fiddling with bind mounts and having another name get you? If you make a new filesystem you can just mount it under /var/www and not overcomplicate it. – mtinberg Aug 31 '11 at 21:40
  • I only figured I would have a clearer view of where things are located from the root. (Not to mention slightly shorter paths.) Thanks for your input! – Stephen M. Harris Sep 1 '11 at 15:02

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.
  • I would suggest using LVM to manage the volume creation and create a new volume any time you have a major application using space, otherwise if you have a large /home as you describe, use bind mounts rather than symlinks, as there are a few corner cases where they work better. The distinction between user/system data is blurred as many applications store their data in /var such as databases, mail servers, web servers, etc. Gratuitously changing these defaults tends to cause unforeseen problems later. – mtinberg Aug 31 '11 at 18:24
  • this makes sense. Since I am running on a single partition, I'll just stick the standard like Jon Lin specified. – Stephen M. Harris Aug 31 '11 at 18:44

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.