
正文
Nginx 缓存针对打开的文件句柄与原文件信息
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
L:108
open_file_cache
syntax: open_file_cache off;
open_file_cache max=N[inactive=time]( inactive表示如果在指定时间内没有访问则移除缓存 );
default: off;
context:http,server,location
open_file_cache_errors 针对缓存信息错误的是否缓存
open_file_cache_min_uses 是指至少使用指定的次数才会保留在缓存中
open_file_cache_valid 根据指定时间确定缓存是否有效,否则就更新缓存
server {
listen ;
server_name shop**.com.cn;
root /tmp_html;
location /{
open_file_cache max= inactive=60s;
open_file_cache_min_uses ;
open_file_cache_valid ;
open_file_cache_errors on;
}
}
当我们用命令 strace -p nginx子进程号去看
会发现第一次会有Open打开文件句柄
第二次就没有open和close操作了






