与
ESC
输入关键词搜索文章

Nginx和Tengine下如何安装nginx_concat_module

全文约 329 字预计阅读 2 分钟
安装模块: 首先下载个nginx_concat_module模块源码,首选https://github.com/taobao/nginx-http-concat,淘宝自己的网址http://code.taobao.org/p/nginx_concat_module/src/ 这里的好像比较旧。 这里以nginx升级更新模块演示,不是全新安装。 下再个nginx稳定版1.8.1 wget http://nginx.org/download/nginx-1.8.1.tar.gz tar zxvf nginx-1.8.1.tar.gz cd nginx-1.8.1/ ./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-ipv6 --add-module=/usr/local/src/nginx-http-concat/ make mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.old #备份 cp objs/nginx /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx -t make upgrade /usr/local/nginx/sbin/nginx -v   配置文件: location /js/ { # 打开concat 功能 # 默认关闭 concat on; # 允许concat最大的文件数(http://www.netpc.com.cn/css/??1.css,2.css,3.css…10.css) 默认最大设置十个文件。 # (默认: 10) # concat_max_files 10; # 只允许相同类型的文件(例:http://www.netpc.com.cn/js/??1.css,2.js 默认情况下是不允许的) # 默认是开启的 off 就可以混搭 # concat_unique on; # 允许内容的类型 # (default: application/x-javascript, text/css) # concat_types text/html; } 如何使用: http://localhost/js/??a.js,b.js 两个问号(??),需要合并的文件(a.js,b.js) 都比较简单,有问题可以留言。
Nginx和Tengine下如何安装nginx_concat_module
分享

发表评论

评论 0 条

暂无评论,来说点什么吧。