Nginx-concat-Module 减轻http请求连接数

http://blog.zongzk.com/index/archives/742

 

Nginx_concat_module是淘宝( JoshuaZhu )开发的基于Nginx减少HTTP请求数量的扩展模块,主要是用于合并减少前段用户Request的HTTP请求的数量。

taobao.com
taobao.com使用 concat_module  进行css样式合并。
安装:
安装 nginx_concat_module 需要重新编译 nginx。可以从这里 checkout 最新的代码,
svn checkout  http://code.taobao.org/svn/nginx_concat_module/trunk/  $NGINX_CONCAT_MODULE
然后下载适合你自己版本的 nginx 源码包,在 ./configure 中增加参数
–add-module=$NGINX_CONCAT_MODULE
      
cd /us/local/src
wget http://nginx.org/download/nginx-1.0.10.tar.gz
tar xzvf nginx-1.0.10.tar.gz
cd nginx-1.0.10/
./configure –user=www –group=www  –prefix=/usr/local/nginx –with-http_stub_status_module  –with-http_sub_module    –with-http_flv_module   –with-http_gzip_static_module   –add-module=../nginx_concat_module/  && make && make install
使用方法:
  1. location /temp/ {
  2.                  # 打开concat 功能
  3.                  # 默认关闭
  4.                  concat on;
  5.                  # 允许concat最大的文件数(http://www.zongzk.com/temp/??1.css,2.css,3.css…10.css) 默认最大设置十个文件。
  6.                  # (默认: 10)
  7.                  # concat_max_files 10;
  8.                  # 只允许相同类型的文件(例:http://www.zongzk.com/temp/??zzk.css,zongzk.js 默认情况下是不允许的)
  9.                  # 默认是开启的
  10.                  # concat_unique on;
  11.                  # 允许内容的类型
  12.                  # (default: application/x-javascript, text/css)
  13.                  # concat_types text/html;
  14.         }
  1. #for i in {1..100};do echo “$i” > ./”$i”.css ;done
使用浏览器或者curl 进行访问
http://www.zongzk.com/temp/??1.css,2.css,3.css…10.css
–>
Ps:
css/js 有顺序需求谨慎使用。
注意不要和rewrite 发生冲突。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值