1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
| 功能: 当访问多个小文件时, 把他们合并到一次http请求中, 提高性能
模块: nginx_http_concat_module
下载: https://github.com/alibaba/nginx-http-concat
编译: --add-module=/opt/nginx-http-concat/
下载之后的路径
使用方法:
在URI后加上 "??",后通过多个 "," 逗号分隔文件。
如果还有参数,则在最后通过 "?" 添加参数
eg: https://g.alicdn.com/??kissy/k/6.2.4/seed-min.js,kg/global-util/1.0.7/index-min.js,tb/tracker/4.3.5/index.js,kg/tb-nav/2.5.3/index-min.js,secdev/sufei_data/3.3.5/index.js
指令: concat on | off #打开/关闭 concat
默认: concat off
可以出现在: http server location
指令: concat_delimiter: string #将文件内容通过指定分隔符指定
默认: NONE
可以出现在: http, server, locatione
指令: concat_types : MIME types #对哪些文件类型做合并
默认: concat types: text/css application/x-javascript
可以出现在: http, server, location
指令: concat_unique: on | off #是否对某一种类型还是多种类型文件进行合并
默认: concat_unique on
可以出现在: http, server, location
指令: concat_max_files : numberp #最多合并多少文件
默认: concat_max_files 10
可以出现在: http, server, location
指令: concat_ignore_file_error : on | off #是否对不存在或者出现错误的文件进行忽略,直接进行下一个文件
默认: off
可以出现在: http, server, location
server {
listen 15637;
server_name www.fscloude.cn;
root /var/www/test/;
concat on;
error_log logs/concat_test.log info;
location / {
concat_max_files 20;
concat_types text/plain; #只允许txt文件,其他文件访问会返回 400 bad request
concat_unique on;
concat_delimiter '||';
concat_ignore_file_error on;
}
}
|