配置缓存过期时间

#语法
Syntax:    expires [modified] time;
        expires epoch | max | off;
Default:    expires off;
Context:    http, server, location, if in location

#配置过期时间
[root@web01 ~]# vim /etc/nginx/conf.d/cacha.conf 
server {
    listen 80;
    server_name linux.cache.com;
    root /code/cache;

    location ~* \.(jpg|png|gif)$ {
        root /code/cache;
        expires 7d;          #7天
    }
}

 

posted @ 2020-09-11 15:29  六月OvO  阅读(244)  评论(0编辑  收藏  举报