阿里开源的第三方模块下载地址:https://github.com/alibaba/nginx-http-concat

下载模块

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

 编译进nginx里

cd nginx-1.15.9/
使用--add-module=参数指定第三方模块路径
./configure --prefix=/data/web --sbin-path=/usr/bin --user=nginx --group=nginx --with-http_stub_status_module --with-http_auth_request_module --add-module=/root/nginx-http-concat
make 主
cp ~/nginx-1.15.9/objs/nginx /usr/bin/ 把可执行文件复制指定目录,备份之前可执行文件

  配置

server {
server_name concat.com;
error_log logs/concat_error.log debug;
concat on; #是否启用
root html;
location /concat {
concat_max_files 30; # 定义可在给定上下文中连接的最大文件数。请注意给定的URI不能大于平台的页面大小。在Linux上,您可以获得页面大小发布:
concat_types text/plain text/css text/html;#定义可在给定上下文中连接的MIME类型
concat_unique on;#定义是否只能连接给定MIME类型的文件,或者是否可合并多类型。例如,如果off 在给定的上下文中设置为then,则可以连接Javascript和CSS文件。请注意,默认值为on,意味着只有具有相同MIME类型的文件在给定上下文中连接。所以,如果你有CSS和JS,你不能做这样的事情:为了做到这一点,你必须设置concat_unique off。这适用于您决定通过添加相应的MIME类型来连接的任何其他类型的文件concat_types,
concat_delimiter ':::'; #定义两个文件之间的分隔符。如果配置为concat_delimiter“\ n”,则当访问http://example.com/??1.js,2.js时,将在1.js和2.js之间插入'\ n'。
concat_ignore_file_error on;#是否忽略404和403。
}
}  

网页

[root@python html]# mkdir concat
[root@python html]# cd concat/
[root@python concat]# echo "1.txt" > 1.txt
[root@python concat]# echo "2.txt" > 2.txt
[root@python concat]# echo "2.css" > 2.css
[root@python concat]# echo "1.css" > 1.css

  

测试

[root@python vhast]# curl www.concat.com/concat/??1.css,2.txt,2.css,1.txt
1.css
:::2.txt
:::2.css
:::1.txt
[root@python vhast]# curl www.concat.com/concat/??1.css,2.txt,1.txt
1.css
:::2.txt
:::1.txt
[root@python vhast]# curl www.concat.com/concat/??1.txt,2.txt
1.txt
:::2.txt

  

  

最新文章

  1. bootstrap表格分页
  2. IIS网站或系统验证码不显示问题——"使用了托管的处理程序,但是未安装或未完整安装 ASP.NET"
  3. 参考__MySql
  4. Swift 03.Dictionary
  5. 004_URL 路由 - 定制路由系统 & 使用区域
  6. ActiveMQ实现负载均衡+高可用部署方案(转)
  7. 文件转换神器Pandoc使用
  8. UVa 272 Tex Quotes --- 水题
  9. OC基础(17)
  10. Gumshoe - Microsoft Code Coverage Test Toolset
  11. apache 实用配置
  12. QTableWidget中添加按钮
  13. js下读取input中的value值
  14. 微信公众平台开发实战Java版之如何网页授权获取用户基本信息
  15. 3.bootstrap-组件
  16. ZOJ-1649 Rescue---BFS+优先队列
  17. Java的LinkedList详解,看源码之后的总结
  18. tf.reducemean()到底是什么意思?
  19. linux 乌班图 xshell链接不上服务器
  20. 极致21点开发DAY2

热门文章

  1. Linux 改变文件的所有者
  2. 素问 - 信贷和GDP
  3. Linux kali添加root用户密码
  4. django 模版查找路径
  5. eclipse中使用maven update project功能后,默认又回到了jre 1.5的解决方案
  6. MAC Address-Table Move Update Feature
  7. STM32 MDK C 常见易错点
  8. javaweb项目运转流程
  9. java基础数据类型和处理
  10. MQTT 入门介绍