forked from ucphhpc/docker-migrid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nginx-proxy-gdp.test.conf
180 lines (160 loc) · 5.37 KB
/
nginx-proxy-gdp.test.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
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# If we receive X-Forwarded-Proto, pass it through; otherwise, pass along the
# scheme used to connect to this server
map $http_x_forwarded_proto $proxy_x_forwarded_proto {
default $http_x_forwarded_proto;
'' $scheme;
}
# If we receive X-Forwarded-Port, pass it through; otherwise, pass along the
# server port the client connected to
map $http_x_forwarded_port $proxy_x_forwarded_port {
default $http_x_forwarded_port;
'' $server_port;
}
# If we receive Upgrade, set Connection to "upgrade"; otherwise, delete any
# Connection header that may have been passed to this server
map $http_upgrade $proxy_connection {
default upgrade;
'' close;
}
# Set appropriate X-Forwarded-Ssl header
map $scheme $proxy_x_forwarded_ssl {
default off;
https on;
}
log_format migvhost '$host $remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent"';
access_log off;
# HTTP 1.1 support
# IMPORTANT: Catch all plain HTTP vhost to avoid ending up as an open proxy
server {
listen 80 default_server;
listen [::]:80 default_server;
# NOTE: invalid vhost if we actually get here - always fail
return 403;
}
# Now handle all valid vhost http requests with proxy for LetsEncrypt, etc.
server {
listen 80;
listen [::]:80;
server_name gdp.test www.gdp.test ext.gdp.test cert.gdp.test oid.gdp.test sid.gdp.test;
# NOTE: this will likely fail unless an .well-known/acme-challenge path
# is requested because the backend will try to redirect it to
# internal https location instead.
location / {
proxy_pass http://gdp.test;
}
# TODO: force all but LetsEncrypt verification requests to https
#location / {
# return 301 https://$host$request_uri;
#}
access_log /var/log/nginx/access.log migvhost;
}
# gdp.test
upstream gdp.test {
## Can be connected with "docker-migrid_default" network
# migrid
server migrid:80;
}
# www.gdp.test (public web server on HTTPS)
upstream www.gdp.test {
## Can be connected with "docker-migrid_default" network
# migrid
server migrid:444;
}
server {
server_name www.gdp.test;
listen 444 ssl http2 ;
access_log /var/log/nginx/access.log migvhost;
ssl_certificate /etc/nginx/certs/www.gdp.test.crt;
ssl_certificate_key /etc/nginx/certs/www.gdp.test.key;
# NOTE: allow bigger uploads to avoid breaking chunked upload on web
client_max_body_size 64M;
# NOTE: include the general https hardening everywhere with HTTPS
include /etc/nginx/harden-https.conf;
location / {
proxy_pass https://www.gdp.test;
}
}
# ext.gdp.test (internal openid vhost - i.e. mig_oid)
# IMPORTANT: openid redirect ping-pong appears to require vhost on port 443
# We moved www vhost to 444 instead until we have multiple IPs.
upstream ext.gdp.test {
## Can be connected with "docker-migrid_default" network
# migrid
server migrid:443;
}
server {
server_name ext.gdp.test;
listen 443 ssl http2 ;
access_log /var/log/nginx/access.log migvhost;
ssl_certificate /etc/nginx/certs/ext.gdp.test.crt;
ssl_certificate_key /etc/nginx/certs/ext.gdp.test.key;
# NOTE: allow bigger uploads to avoid breaking chunked upload on web
client_max_body_size 64M;
# NOTE: include the general https hardening everywhere with HTTPS
include /etc/nginx/harden-https.conf;
location / {
proxy_pass https://ext.gdp.test;
}
}
# oid.gdp.test (external openid vhost - i.e. ext_oid)
upstream oid.gdp.test {
## Can be connected with "docker-migrid_default" network
# migrid
server migrid:445;
}
server {
server_name oid.gdp.test;
listen 445 ssl http2 ;
access_log /var/log/nginx/access.log migvhost;
ssl_certificate /etc/nginx/certs/oid.gdp.test.crt;
ssl_certificate_key /etc/nginx/certs/oid.gdp.test.key;
# NOTE: allow bigger uploads to avoid breaking chunked upload on web
client_max_body_size 64M;
# NOTE: include the general https hardening everywhere with HTTPS
include /etc/nginx/harden-https.conf;
location / {
proxy_pass https://oid.gdp.test;
}
}
# cert.gdp.test (internal cert vhost - i.e. mig_cert)
upstream cert.gdp.test {
## Can be connected with "docker-migrid_default" network
# migrid
server migrid:446;
}
server {
server_name cert.gdp.test;
listen 446 ssl http2 ;
access_log /var/log/nginx/access.log migvhost;
ssl_certificate /etc/nginx/certs/cert.gdp.test.crt;
ssl_certificate_key /etc/nginx/certs/cert.gdp.test.key;
# NOTE: allow bigger uploads to avoid breaking chunked upload on web
client_max_body_size 64M;
# NOTE: include the general https hardening everywhere with HTTPS
include /etc/nginx/harden-https.conf;
location / {
proxy_pass https://cert.gdp.test;
}
}
# sid.gdp.test
upstream sid.gdp.test {
## Can be connected with "docker-migrid_default" network
# migrid
server migrid:448;
}
server {
server_name sid.gdp.test;
listen 448 ssl http2 ;
access_log /var/log/nginx/access.log migvhost;
ssl_certificate /etc/nginx/certs/sid.gdp.test.crt;
ssl_certificate_key /etc/nginx/certs/sid.gdp.test.key;
# NOTE: allow bigger uploads to avoid breaking chunked upload on web
client_max_body_size 64M;
# NOTE: include the general https hardening everywhere with HTTPS
include /etc/nginx/harden-https.conf;
location / {
proxy_pass https://sid.gdp.test;
}
}