您的位置:首页 > 其它

如何获得cisco和juniper设备的详细信息

2013-03-07 16:54 316 查看
论坛头像是动态的,例如:http://xxx.xxx.xxx/avatar.php?uid=xxx&size=big
每个用户的头像文件都有big、middle、small三个,并且在不同场景分别调用不同尺寸的头像图片,比如帖子、个人设置、头像编辑、登陆等等场景,无形中增加了nginx与php之间的工作压力,如果能够把这个解析结果缓存起来,那么就会减少nginx与php的通信压力,会降低系统cpu使用率。

测试nginx缓存功能,配置如下:

http域添加
fastcgi_cache_path /xxxcache levels=1:2 keys_zone=cgicache:30m inactive=1d max_size=10g;

server域添加
location ~* ^/avatar.php?.*$ {
add_header X-Cache-CFC "$upstream_cache_status - $upstream_response_time";
fastcgi_temp_path /xxxtemp;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_cache cgicache;
fastcgi_cache_valid 301 302 1h;
fastcgi_cache_min_uses 1;
fastcgi_cache_use_stale error timeout invalid_header http_500;
fastcgi_cache_key $host$request_uri;
}

通过验证,缓存文件生成成功,http请求换成miss、hit等状态正确。

其它动态程序也可以使用此方法缓存。

本文出自 “菩提” 博客,请务必保留此出处http://zhangxingnan.blog.51cto.com/3241217/1619053
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: