-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnginx.cfg
67 lines (52 loc) · 2.08 KB
/
nginx.cfg
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
# Do not daemonize - this makes it easier to test
# new configurations as any stupid error would be
# more easily caught when developing.
daemon off;
events {
worker_connections 1024;
}
error_log logs/log debug;
http {
# Explicitly telling what mime types we're
# supporting just for the sake of explicitiness
types {
image/svg+xml svg svgz;
text/html html;
}
# Add an upstream server to proxy requests to
upstream sample-http1 {
server localhost:8080;
}
server {
# Listen on port 8443 with http2 support on.
listen 8443 http2;
# Enable TLS such that we can have proper HTTP2
# support using browsers
ssl on;
ssl_certificate certs/cert_example.com.pem;
ssl_certificate_key certs/key_example.com.pem;
# Enable support for using `Link` headers to indicate
# origin server push
http2_push_preload on;
# For the root location (`index.html`) we perform
# a server push of `/image.svg` when serving the
# content to the end user.
location / {
root www;
http2_push "/image.svg";
}
# When pushing the asset (`image.svg`) there's no need
# to push additional resurces.
location /image.svg {
root www;
}
# Act as a reverse proxy for requests going to /proxy/*.
# Because we don't want to rewrite our endpoints in the
# Go app, rewrite the path such that `/proxy/lol` ends up
# as `/lol`.
location /proxy/ {
rewrite /proxy/(.*) /$1 break;
proxy_pass http://sample-http1;
}
}
}