nginx 中 /var/www 和 /srv/www 的区别

Sae*_*umi 5 nginx var

最近我安装的Nginx和想改变的根目录,但我不知道有什么区别之间/var/www/srv/www当我应该使用/var/www/srv/www

ETL*_*ETL 10

区别在于:不同的文件结构。不同的服务器实现的文件结构略有不同。

这里有一个很好的链接,描述了 Linux 中的常见文件结构: Linux Directory Structure (File System Structure) Explained with Examples

由此:

/var – 变量文件

- 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);
Run Code Online (Sandbox Code Playgroud)

/srv – 服务数据

- srv stands for service.
- Contains server specific services related data.
- For example, /srv/cvs contains CVS related data.
Run Code Online (Sandbox Code Playgroud)

基于此,/srv似乎更合适。但是,Linux的例如Ubuntu的味道一般不使用一个/srv文件结构,而是采用了var目录www。所以我认为关键是与您使用的操作系统保持一致。