Skip to content

Commit 47022a4

Browse files
authored
Optimize thingies
- better gzip - better cache - better extension list
1 parent c3bf065 commit 47022a4

File tree

1 file changed

+16
-19
lines changed

1 file changed

+16
-19
lines changed

nginx.conf

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,22 @@
11
server {
2-
listen 80 default_server;
2+
listen 80;
33

4-
gzip on;
5-
gzip_min_length 1000;
6-
gzip_types text/plain text/xml application/javascript text/css;
4+
root /app;
5+
index index.html;
76

8-
root /app;
7+
gzip on;
8+
gzip_static on;
9+
gzip_comp_level 5;
10+
gzip_min_length 1024;
11+
gzip_types text/plain text/css application/javascript application/json image/svg+xml font/woff2;
912

10-
# normal routes
11-
# serve given url and default to index.html if not found
12-
# e.g. /, /user and /foo/bar will return index.html
13-
location / {
14-
add_header Cache-Control "no-store";
15-
try_files $uri $uri/index.html /index.html;
16-
}
13+
location / {
14+
try_files $uri /index.html;
15+
add_header Cache-Control "no-cache, must-revalidate";
16+
}
1717

18-
# files
19-
# for all routes matching a dot, check for files and return 404 if not found
20-
# e.g. /file.js returns a 404 if not found
21-
location ~ \.(?!html) {
22-
add_header Cache-Control "public, max-age=2678400";
23-
try_files $uri =404;
24-
}
18+
location ~* \.(?:js|css|woff2?|eot|ttf|otf|ico|jpg|jpeg|png|gif|svg)$ {
19+
try_files $uri =404;
20+
add_header Cache-Control "public, max-age=31536000, immutable";
21+
}
2522
}

0 commit comments

Comments
 (0)