• 关于linux下/srv、/var和/tmp的职责区分


    转载自:https://blog.csdn.net/u012107143/article/details/54972544?utm_source=itdadao&utm_medium=referral;这里添加个usr的说明,它不是user的意思是该是Unix System Resource的简写,用于存放系统应用,但是用户的个人文档/资料/工作空间等不应该在这个目录或其子孙级目录;而/usr/local目录一般存放一些系统级的应用(系统级就是指这里的应用不是给某个用户用的可以给多个用户使用权限,类似Windows的Program Files目录),如eclipse/idea/tomcat都可以存放在这里。这里要注意/opt和/usr/local的区别,后者就可以理解为Program Files,是我们正常安装一些的系统软件如360/mysql数据库之类的,它们的数据是可以在其它目录的,如浏览器的Download目录,数据库的数据库文件目录都可以也应该在其它目录。而/opt放置的是一些第三方程序,它有个特点是它应该是绿色版的(如tar.gz的程序,但不绝对),应用的所有数据均应该在应用目录之内;比如Windows下的hashtool工具/Http接口测试工具/WebService接口测试工具等等(即跟外界几乎无交互的软件,如无需环境变量,无需快捷方式,无需在其它地方配置,那些不需要设置为服务的tomcat也可以放在这里[只是IDE里可能配置],不用了可以直接删除而不需要做后续操作,如删除对应环境变量,删除/etc下的对应配置或/usr/rc.d下的一些配置的应用)。

    /srv :主要用来存储本机或本服务器提供的服务或数据。用户主动生产的数据、对外提供服务)

    /srv contains site-specific data which is served by this system.

    /var :系统产生的不可自动销毁的缓存文件、日志记录。系统和程序运行后产生的数据、不对外提供服务、只能用户手动清理)(包括mail、数据库文件、日志文件)

    /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.
    If /var cannot be made a separate partition, it is often preferable to move /var out of the root partition and into the /usr partition. (This is sometimes done to reduce the size of the root partition or when space runs low in the root partition.) However, /var must not be linked to /usr because this makes separation of /usr and /var more difficult and is likely to create a naming conflict. Instead, link /var to /usr/var.
    Applications must generally not add directories to the top level of /var. Such directories should only be added if they have some system-wide implication, and in consultation with the FHS mailing list.

     

    /tmp :保存在使用完毕后可随时销毁的缓存文件。(有可能是由系统或程序产生、也有可能是用户主动放入的临时数据、系统会自动清理)

    The /tmp directory must be made available for programs that require temporary files.
    Programs must not assume that any files or directories in /tmp are preserved between invocations of the program.

    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    所以,服务器被用作Web开发时,html文件更应该被放在/srv/www下,而不是/var/www下(因为/srv目录是新标准中才有的,出现较晚;而且Apache将/var/www设为了web默认目录,所以现在绝大多数人都把web文件放在/var/www,这是个历史遗留问题)。

    如ftp、流媒体服务等也应该被放在/srv对应的目录下。如果对应目录太大,应该另外挂载分区。

  • 相关阅读:
    LeetCode 225 Implement Stack using Queues 用队列实现栈
    LeetCode 232 Implement Queue using Stacks 两个栈实现队列
    LeetCode 583 Delete Operation for Two Strings 删除两个字符串的不同部分使两个字符串相同,求删除的步数
    LeetCode 230 Kth Smallest Element in a BST 二叉搜索树中的第K个元素
    LeetCode 236 Lowest Common Ancestor of a Binary Tree 二叉树两个子节点的最低公共父节点
    LeetCode 148 Sort List 链表上的归并排序和快速排序
    LeetCode 069 Sqrt(x) 求平方根
    webpack新版本4.12应用九(配置文件之模块(module))
    webpack新版本4.12应用九(配置文件之输出(output))
    webpack新版本4.12应用九(配置文件之入口和上下文(entry and context))
  • 原文地址:https://www.cnblogs.com/silentdoer/p/8680762.html
Copyright © 2020-2023  润新知