-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathexample.nginx.conf
69 lines (50 loc) · 1.73 KB
/
example.nginx.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
include /etc/nginx/conf.d/*.conf;
# https://github.com/google/ngx_brotli
brotli_static on;
brotli on;
# http://nginx.org/en/docs/http/ngx_http_gzip_module.html
gzip on;
gzip_vary on;
gzip_proxied any;
server {
listen 80;
server_name your_domain;
# Add Alt-Svc header to negotiate HTTP/3.
add_header alt-svc 'h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; ma=86400';
return 301 https://$host$request_uri;
}
server {
# https://github.com/cloudflare/quiche/tree/master/extras/nginx
# Enable QUIC and HTTP/3.
listen 443 quic reuseport;
# Enable HTTP/2 (optional).
listen 443 ssl http2;
server_name your_domain;
ssl_certificate /opt/nginx/certs/live/your_domain/fullchain.pem;
ssl_certificate_key /opt/nginx/certs/live/your_domain/privkey.pem;
# Enable all TLS versions (TLSv1.3 is required for QUIC).
ssl_protocols TLSv1.3;
ssl_early_data on;
#proxy_set_header Early-Data $ssl_early_data;
if ($host != "your_domain") {
return 404;
}
# Add Alt-Svc header to negotiate HTTP/3.
add_header alt-svc 'h3=":443"; ma=86400';
location / {
root html;
index index.html index.htm;
}
location /host {
return 200 "http3 on $hostname";
add_header Content-Type text/plain;
# Add Alt-Svc header to negotiate HTTP/3.
add_header alt-svc 'h3=":443"; ma=86400';
}
}
}