Nginx 过期时间

客户端(浏览器)访问服务器上的资源后,会缓存在浏览器中,对于一些经常变更的静态资源,我们可以设置缓存时间,也就是设置静态资源的过期时间

[root@localhost ~]$ cat /usr/local/nginx/conf/vhost/test.com.conf 
server {
    listen 80;
    server_name www.test.com;
    index index.html index.html index.php;
    root /data/www;
  
    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
        expires 7d;
    }

location ~ .*\.(js|css)$ {
expires 12h;
} }

 

 

 

 

 

 

 

    

posted @ 2019-01-29 11:36  孔雀东南飞  阅读(1189)  评论(0编辑  收藏  举报