上传一张图片到nginx服务上
nginx.conf配置文件增加以下内容
[root@docker html]# vim 、opt/nginx/conf/nginx.conf
添加以下内容:
location ~* \.(gif|jpg|jepg|bmp|ico)$ {
root html;
expires 1d;
}
#重新加载nginx配置
[root@docker html]# nginx -s reload
首次访问,可以看到图片是正常请求的
再次请求就是请求缓存中的图片