nginx静态资源设置缓存的方法 直接加expires 30d; 就是就可以了 缓存时间30天 完整如下location / { root /home/www/wordpress; index index.php index.html index.htm; expires 30d; if (!-e $request_filename) { rewrite ^/p([0-9]*)/$ /?p=$1 last; #rewrite /index.html /?p=967 redirect; break; } }然后重新服务 nginx -s reload 然后测试 打开浏览器network reponseheader里面 Cache-Control:max-age=2592000 30*24*3600=2592000秒
查看原文:http://newmiracle.cn/?p=1879
nginx静态资源设置缓存的方法
最新推荐文章于 2025-06-17 15:57:52 发布