linux /srv 网站文件,關於linux下/srv、/var和/tmp的職責區分

/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, andtransient 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 /usrthat 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 intothe /usr partition.(This is sometimes done to reduce the size of the root partition or when space runs low in theroot partition.)However, /var must not be linked to /usr because this makes separation of /usr and /varmore 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 ifthey 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 theprogram.

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

所以,服務器被用作Web開發時,html文件更應該被放在/srv/www下,而不是/var/www下(因為/srv目錄是新標准中才有的,出現較晚;而且Apache將/var/www設為了web默認目錄,所以現在絕大多數人都把web文件放在/var/www,這是個歷史遺留問題)。

如ftp、流媒體服務等也應該被放在/srv對應的目錄下。如果對應目錄太大,應該另外掛載分區。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值