lnmp nginx 添加nginx-http-concat模块

  nginx-http-concat 是淘宝开发的基于Nginx减少HTTP请求数量的扩展模块,主要是用于合并减少前端用户Request的HTTP请求的数量

 第一步下载

nginx-http-concat

git clone git://github.com/alibaba/nginx-http-concat.git


第二步 移动目录
mv nginx–http–concat /usr/local/src/nginx–http–concat


第三步
进入lnmp 下载目录
cd /home/lnmp1.3-full 我的下载解压目录为/home/www/lnmp1.3-full


第四步
编辑 lnmp.conf
vim lnmp.conf
添加 
Nginx_Modules_Options='--add-module=/home/software/nginx-http-concat '
保存后退出
最后一步
./upgrade.sh nginx


一直到编译完成


这时就可以去配置  nginx/conf/vhost 下面的域名.conf 文件了


location /assets/
        {
             concat on;
             concat_max_files 20;
       }
编译成功后还要注意合并js时的400 Bad Request错误


由于Nginx在新版本中,使用了标准的 MIME-Type:application/javascript。而在nginx_concat_module模块目前版本的代码中,写的是 application/x-javascript 的类型


修改 nginx-http-concat/ngx_http_concat_module.c


把 x-javascript 改为 javascript


重新编译nginx即可
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值