Nginx优化_定义对静态页面的缓存时间
2024-09-02 09:41:20
修改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浏览器访问图片,查看缓存信息
结束.
最新文章
- CSS3的flex布局
- A Multipart Series on Grids in ASP.NET MVC
- [DevExpress]DxValidationProvider分享
- HDU 5969 最大的位或 【贪心】 (2016年中国大学生程序设计竞赛(合肥))
- web.xml在&;lt;init-param&;gt;一个错误
- LeetCode OJ 257. Binary Tree Paths
- SpringBoot 2.X集成Hive-jdbc 3.1.1
- laravel之数据库
- 结对项目-WordCount
- pt站 扫盲贴 面向小白
- 报错 hint: Updates were rejected because the remote contains work that you do 解决方法
- python, 在信用评级中,计算KS statistic值
- SQL经常使用的一些词
- java String.intern();
- 使用Intel IPT技术保护您的帐号安全
- python os.mkdir与 os.makedirs
- PhoneGap 白名单安全机制 navigator.app 加载外部页面返回以及退出介绍
- Elasticsearch Suggester 学习
- 在使用angular和swiper插件中的一些问题
- windows服务器间文件同步搭建步骤搜集
热门文章
- 学习wavenet_vocoder之环境配置
- 转载:mybatis中<;![CDATA[]]>;的作用
- React Native商城项目实战10 - 个人中心中间内容设置
- base64加密小案例
- 剑指offer--day08
- [9期]软WAF上传绕过+webshell免杀
- chapter2
- VS2012发布Web应用程序
- 20190909 SpringBoot集成Swagger
- Path.GetExtension 方法 (String)