-
Notifications
You must be signed in to change notification settings - Fork 1
/
default.conf
53 lines (44 loc) · 2.2 KB
/
default.conf
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
server {
listen 80;
server_name localhost;
# enable gzip compression of simple text files when transmitting to clients
# that can handle gzip/deflate responses.
# do not gzip json files because range requests to .json files made by browser js
# applications like archive.org/details/webshots-freeze-frame-index get whole object,
# not the range
gzip on;
gzip_types "text/html; charset=utf-8" text/html text/plain text/javascript application/x-javascript application/javascript text/css text/csv text/xml application/xml;
# add charset info to Content-Type header for text files
# by default, will apply to files with the following mime types:
# text/(plain|html|xml|vnd.wap.wml), application/(javascript|rss+xml)
# if we wish to apply it to additional mime types (say, application/json), we can add a charset_types directive
# see https://nginx.org/en/docs/http/ngx_http_charset_module.html for more details
charset utf-8;
root /usr/share/nginx/html;
location / {
index index.html index.htm;
# customizations:
autoindex on;
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Methods GET,POST,OPTIONS;
add_header Access-Control-Allow-Headers Accept-Encoding,Accept-Language,Authorization,Cache-Control,Content-Length,Content-Range,DNT,Pragma,Range,X-Requested-With;
add_header Vary Origin;
}
# customization - like 1st location, but with `Content-Encoding` header
location ~ \.gz$ {
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Methods GET,POST,OPTIONS;
add_header Access-Control-Allow-Headers Accept-Encoding,Accept-Language,Authorization,Cache-Control,Content-Length,Content-Range,DNT,Pragma,Range,X-Requested-With;
add_header Vary Origin;
add_header Content-Encoding gzip;
location ~ \.(js|wasm)\.gz$ {
# these files additionally need specific content type
types { }
default_type application/javascript;
}
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}