Recently i installed Nginx and want to change the root directory of that but i don't know what the difference is between /var/www and /srv/www and when i should use /var/www or /srv/www ?


The difference is: different file structure. Different servers implement slightly different file structures.

Here is a good link that describes common file structures in Linux: Linux Directory Structure (File System Structure) Explained with Examples

From this:

/var – Variable Files

- var stands for variable files.
- Content of the files that are expected to grow can be found under this directory.
- This includes — system log files (/var/log); packages and database files (/var/lib);  
  emails (/var/mail); print queues (/var/spool); lock files (/var/lock);
  temp files needed across reboots (/var/tmp);

/srv – Service Data

- srv stands for service.
- Contains server specific services related data.
- For example, /srv/cvs contains CVS related data.

Based on that, /srv would seem more appropriate. However, the Ubuntu flavor of Linux for example does not generally use a /srv file structure and rather uses the var directory for www. So I think the key is being consistent with the OS you use.

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.