Skip to content

Commit 4665657

Browse files
authored
Merge pull request #874 from DuendeSoftware/mb/caching
Add caching and response compression
2 parents f45e985 + c8321b6 commit 4665657

File tree

2 files changed

+50
-1
lines changed

2 files changed

+50
-1
lines changed

deployment/default.conf

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,33 @@
1+
map $sent_http_content_type $expires {
2+
default off;
3+
~_astro/ 1y;
4+
text/html 1m;
5+
text/css 1y;
6+
application/javascript 1y;
7+
application/json 1y;
8+
font/woff 1y;
9+
font/woff2 1y;
10+
image/svg+xml 1M;
11+
image/svg 1M;
12+
image/jpeg 7d;
13+
image/png 7d;
14+
image/webp 7d;
15+
image/x-icon 7d;
16+
}
17+
118
server {
219
listen 8080;
320
listen [::]:8080;
421
server_name localhost;
22+
23+
expires $expires;
24+
525
location / {
626
root /usr/share/nginx/html;
727
index index.html index.htm;
828
add_header X-REVISION $APPLICATION_VERSION;
929
}
30+
1031
include /etc/nginx/extra/*.conf;
1132

1233
error_page 404 /404.html;

deployment/nginx.conf

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,35 @@ http {
2525

2626
keepalive_timeout 65;
2727

28-
gzip on;
28+
gzip on;
29+
gzip_disable "msie6";
30+
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_min_length 256;
37+
gzip_types
38+
application/atom+xml
39+
application/geo+json
40+
application/javascript
41+
application/x-javascript
42+
application/json
43+
application/ld+json
44+
application/manifest+json
45+
application/rdf+xml
46+
application/rss+xml
47+
application/xhtml+xml
48+
application/xml
49+
font/eot
50+
font/otf
51+
font/ttf
52+
image/svg+xml
53+
text/css
54+
text/javascript
55+
text/plain
56+
text/xml;
2957

3058
include /etc/nginx/conf.d/*.conf;
3159
}

0 commit comments

Comments
 (0)