Skip to content

Commit 35cd699

Browse files
committed
moved gzip configuration to separate snippet
1 parent d753040 commit 35cd699

File tree

3 files changed

+34
-32
lines changed

3 files changed

+34
-32
lines changed

nginx.conf

+6-1
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,20 @@ events {
77
}
88

99
http {
10-
1110
include mime.types;
1211
default_type application/octet-stream;
1312
sendfile on;
1413
tcp_nopush on;
1514
tcp_nodelay on;
1615
server_tokens off;
16+
17+
# reasonable default, as 1MB is almost always not enough
1718
client_max_body_size 100M;
1819

20+
# enable gzip support
21+
include server-gzip.conf;
22+
23+
# auto-ssl lua magic for automatic generation of certs
1924
include resty-http.conf;
2025

2126
server {

snippets/server-gzip.conf

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
gzip on;
2+
gzip_disable "msie6";
3+
gzip_vary on;
4+
gzip_proxied any;
5+
gzip_comp_level 6;
6+
gzip_buffers 16 8k;
7+
gzip_http_version 1.1;
8+
gzip_types
9+
application/javascript
10+
application/rss+xml
11+
application/vnd.ms-fontobject
12+
application/x-font
13+
application/x-font-opentype
14+
application/x-font-otf
15+
application/x-font-truetype
16+
application/x-font-ttf
17+
application/x-javascript
18+
application/xhtml+xml
19+
application/xml
20+
font/opentype
21+
font/otf
22+
font/ttf
23+
image/svg+xml
24+
image/x-icon
25+
text/css
26+
text/javascript
27+
text/plain
28+
text/xml;

snippets/server-proxy.conf

-31
Original file line numberDiff line numberDiff line change
@@ -23,36 +23,5 @@ server {
2323
proxy_set_header Upgrade $http_upgrade;
2424
proxy_set_header Connection $connection_upgrade;
2525
proxy_cache_bypass $http_upgrade;
26-
27-
client_max_body_size 100M;
28-
29-
gzip on;
30-
gzip_disable "msie6";
31-
gzip_vary on;
32-
gzip_proxied any;
33-
gzip_comp_level 6;
34-
gzip_buffers 16 8k;
35-
gzip_http_version 1.1;
36-
gzip_types
37-
application/javascript
38-
application/rss+xml
39-
application/vnd.ms-fontobject
40-
application/x-font
41-
application/x-font-opentype
42-
application/x-font-otf
43-
application/x-font-truetype
44-
application/x-font-ttf
45-
application/x-javascript
46-
application/xhtml+xml
47-
application/xml
48-
font/opentype
49-
font/otf
50-
font/ttf
51-
image/svg+xml
52-
image/x-icon
53-
text/css
54-
text/javascript
55-
text/plain
56-
text/xml;
5726
}
5827
}

0 commit comments

Comments
 (0)