-
-
Notifications
You must be signed in to change notification settings - Fork 137
Expand file tree
/
Copy pathnginx-static.conf
More file actions
110 lines (80 loc) · 2.09 KB
/
nginx-static.conf
File metadata and controls
110 lines (80 loc) · 2.09 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
server {
listen 80;
server_name localhost;
server_tokens off;
root /static;
location / {
autoindex on;
gzip_static on;
brotli_static on;
expires 1d;
}
# disable compresssion for a specific asset
location /static/jquery-1.4.4.min.js {
gzip off;
}
# modify the cache expiration for these URLs
location /static/mdn-no-cache.png {
alias /static/static/mdn.png;
expires 0;
}
location /static/mdn-short-cache.png {
alias /static/static/mdn.png;
expires 1h;
}
# 4xx and 5xx error codes
# https://httpstatuses.com/401
location /_401 {
return 401;
}
# https://httpstatuses.com/403
location /_403 {
return 403;
}
# https://httpstatuses.com/500
location /_500 {
return 500;
}
}
server {
# http/1.1 and old TLS (do not change!)
listen 443 ssl;
server_name localhost;
ssl_certificate /etc/nginx/localhost.crt;
ssl_certificate_key /etc/nginx/localhost.key;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_protocols TLSv1.1;
root /static;
location / {
autoindex on;
}
}
server {
# http/2
listen 444 ssl http2;
server_name localhost;
ssl_certificate /etc/nginx/localhost.crt;
ssl_certificate_key /etc/nginx/localhost.key;
root /static;
location / {
autoindex on;
}
}
server {
# quic and http/3
listen 445 http3 reuseport;
# http/2 fallback
listen 445 ssl http2;
server_name localhost;
ssl_certificate /etc/nginx/localhost.crt;
ssl_certificate_key /etc/nginx/localhost.key;
# Enable all TLS versions (TLSv1.3 is required for QUIC).
ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
# Add Alt-Svc header to negotiate HTTP/3.
# port 9001 is what's presented to the client (see docker compose YAML file)
add_header alt-svc 'h3-27=":9001"; ma=86400, h3-28=":9001"; ma=86400, h3-29=":9001"; ma=86400';
root /static;
location / {
autoindex on;
}
}