Reputation: 413
I see some tutorials where people place their project files under var/www
in linux environments as opposed to say ... the nginx default dir usr/share/nginx/html
in many nginx related tutorials.
I would like to know if there is some benefit to putting your projects there as opposed to the default directory.
Upvotes: 0
Views: 99
Reputation: 80992
I believe the purposes listed for the /usr
and /var
hierarchies in the FHS should answer this question fairly well.
About /usr
:
/usr is the second major section of the filesystem. /usr is shareable, read-only data. That means that /usr should be shareable between various FHS-compliant hosts and must not be written to. Any information that is host-specific or varies with time is stored elsewhere.
About /var
:
/var contains variable data files. This includes spool directories and files, administrative and logging data, and transient and temporary files.
Some portions of /var are not shareable between different systems. For instance, /var/log, /var/lock, and /var/run. Other portions may be shared, notably /var/mail, /var/cache/man, /var/cache/fonts, and /var/spool/news.
/var is specified here in order to make it possible to mount /usr read-only. Everything that once went into /usr that is written to during system operation (as opposed to installation and software maintenance) must be in /var.
Upvotes: 2