修改Nginx配置文件,定义对静态页面的缓存时间

proxy ]# vim /usr/local/nginx/conf/nginx.conf

server {

listen 80;

server_name localhost;

location / {

root html;

index index.html index.htm;

}

location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ {

expires    30d;            //定义客户端缓存时间为30天

}

}

proxy ]# cp /usr/share/backgrounds/day.jpg   /usr/local/nginx/html  /拷贝一个jpg文件到网页目录

proxy ]# /usr/local/nginx/sbin/nginx -s reload

# firefox http://192.168.4.5/day.jpg      //优化后,使用Firefox浏览器访问图片,查看缓存信息

结束.

最新文章

  1. CSS3的flex布局
  2. A Multipart Series on Grids in ASP.NET MVC
  3. [DevExpress]DxValidationProvider分享
  4. HDU 5969 最大的位或 【贪心】 (2016年中国大学生程序设计竞赛(合肥))
  5. web.xml在<init-param>一个错误
  6. LeetCode OJ 257. Binary Tree Paths
  7. SpringBoot 2.X集成Hive-jdbc 3.1.1
  8. laravel之数据库
  9. 结对项目-WordCount
  10. pt站 扫盲贴 面向小白
  11. 报错 hint: Updates were rejected because the remote contains work that you do 解决方法
  12. python, 在信用评级中,计算KS statistic值
  13. SQL经常使用的一些词
  14. java String.intern();
  15. 使用Intel IPT技术保护您的帐号安全
  16. python os.mkdir与 os.makedirs
  17. PhoneGap 白名单安全机制 navigator.app 加载外部页面返回以及退出介绍
  18. Elasticsearch Suggester 学习
  19. 在使用angular和swiper插件中的一些问题
  20. windows服务器间文件同步搭建步骤搜集

热门文章

  1. 学习wavenet_vocoder之环境配置
  2. 转载:mybatis中<![CDATA[]]>的作用
  3. React Native商城项目实战10 - 个人中心中间内容设置
  4. base64加密小案例
  5. 剑指offer--day08
  6. [9期]软WAF上传绕过+webshell免杀
  7. chapter2
  8. VS2012发布Web应用程序
  9. 20190909 SpringBoot集成Swagger
  10. Path.GetExtension 方法 (String)