-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefault.conf.template
70 lines (63 loc) · 1.84 KB
/
default.conf.template
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
charset utf-8;
tcp_nodelay off;
# Defines a timeout for reading client request header.
# Default value is 60s
client_header_timeout 10s;
# Defines a timeout for reading client request body.
# Default value is 60s
client_body_timeout 10s; # Reduce this because we use only GET without body in SPA apps
# Sets the maximum allowed size of the client request body, specified in the “Content-Length” request header field.
# Default value is 1m
client_max_body_size 64k; # Reduce this because we use only GET without body in SPA apps
# Enables or disables gzipping of responses
gzip on;
# Sets a gzip compression level of a response
# Default value is 1
gzip_comp_level 3;
# Enables gzipping of responses for the specified MIME types in addition to “text/html”
gzip_types
application/atom+xml
application/javascript
application/json
application/ld+json
application/manifest+json
application/rss+xml
application/vnd.geo+json
application/vnd.ms-fontobject
application/x-font-ttf
application/x-javascript
application/x-web-app-manifest+json
application/xhtml+xml
application/xml
font/opentype
font/truetype
image/bmp
image/svg+xml
image/x-icon
text/cache-manifest
text/css
text/javascript
text/plain
text/vcard
text/vnd.rim.location.xloc
text/vtt
text/x-component
text/x-cross-domain-policy
text/xml;
# With SPA, the index is small and we use hashed resources (for CSS and JS)
map $sent_http_content_type $expires {
default off;
text/html -1; # HTML may change to use new hashed CSS or JS, that's why we should use no-cache
~image/ 24h; # Images may change and aren't hashed
}
server {
listen ${NGINX_LISTEN_ADDRESS};
root /usr/share/nginx/html;
expires $expires;
location / {
try_files $uri @rewrites;
}
location @rewrites {
rewrite ^(.+)$ /index.html last;
}
}