Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does Apache point to /var/www?

This is just for my own curiosity. Isn't the purpose of the var directory to hold files that the system writes? For example: logs, cache, lock, etc.

I understand that you can direct apache to point to anywhere by modifying the configuration files, but I just don't understand why the default location would be /var/www.

like image 309
systemizer Avatar asked Jun 12 '11 14:06

systemizer


2 Answers

/var/ is for

Variable files —- files whose content is expected to continually change during normal operation of the system —- such as logs, spool files, and temporary e-mail files. Sometimes a separate partition.

-- Wikipedia

thus not necessarily things that the system writes. I agree that www is a bit of an odd duck - it is not supposed to be all that variable. Some distros have it under /usr/share, some in other places - /var/www is not universally acknowledged. Actually, according to the FHS, the www data should be under /srv, but few systems I encountered seem to adhere to that.

like image 156
Amadan Avatar answered Sep 29 '22 05:09

Amadan


I was curious too, so I dug through some old mailing list posts. It looks like part of the motivation was that /var is most likely kept on a read-write file system or device, whereas other parts of the system might be read-only (CD, etc). As someone else said /var is for variable files so by definition it shouldn't be read-only.

Apache don't have control over how an installation is configured by default, that's more down to the linux distribution developers. Looking at some Debian discussions about /srv/www the responses seem to be "just leave it as it is".

like image 27
Tak Avatar answered Sep 29 '22 06:09

Tak