-
Notifications
You must be signed in to change notification settings - Fork 9
/
nginx.yml
169 lines (152 loc) · 7.34 KB
/
nginx.yml
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
#cloud-config
# $ aws ec2 run-instances --user-data file://nginx.yml --security-groups "ssh-dns" --image-id ami-5189a661 --instance-type t2.medium --region us-west-2
# Must copy private ssl keys manually to /etc/nginx/ssl/*/server.key then restart nginx.
# Choose instance size based on network performance required.
apt_sources:
- source: ppa:nginx/stable
bootcmd:
- cloud-init-per once ssh-users-ca echo "TrustedUserCAKeys /etc/ssh/users_ca.pub" >> /etc/ssh/sshd_config
output:
all: '| tee -a /var/log/cloud-init-output.log'
package_upgrade: true
packages:
- nginx
- ntp
- unattended-upgrades
- update-notifier-common
power_state:
mode: reboot
write_files:
- path: /etc/apt/apt.conf.d/20auto-upgrades
content: |
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";
- path: /etc/apt/apt.conf.d/50unattended-upgrades
content: |
Unattended-Upgrade::Allowed-Origins {
"${distro_id} ${distro_codename}-security";
};
Unattended-Upgrade::Automatic-Reboot "true";
- path: /etc/motd
content: |
#############################################
## Nginx proxy server ##
## For demo instances: ##
## ssh <name>.instance.clinicalgenome.org ##
#############################################
- path: /etc/nginx/nginx.conf
content: |
user www-data;
worker_processes auto;
worker_rlimit_nofile 8192;
events {
worker_connections 2048;
}
http {
resolver 172.31.0.2; # AWS VPC DNS Server
resolver_timeout 5s;
include mime.types;
client_max_body_size 500m;
default_type application/octet-stream;
keepalive_timeout 65;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
proxy_buffers 8 16k;
proxy_send_timeout 5m;
proxy_read_timeout 5m;
send_timeout 5m;
server {
listen 80;
location = /robots.txt {
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://app;
proxy_http_version 1.1;
proxy_set_header Connection "";
}
location / {
if ($request_method !~ ^(GET)|(HEAD)$) {
return 405;
}
return 301 https://$host$request_uri;
}
}
server {
listen 443 ssl spdy;
server_name ~^(?<servername>[^.]+)\.demo\.clinicalgenome\.org$;
ssl_certificate /etc/nginx/ssl/demo.clinicalgenome.org/server.chained.crt;
ssl_certificate_key /etc/nginx/ssl/demo.clinicalgenome.org/server.key;
location / {
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://$servername.instance.clinicalgenome.org;
proxy_http_version 1.1;
proxy_set_header Connection "";
}
location ~ ^/_proxy/(.*)$ {
internal;
proxy_buffering off;
proxy_pass $1$is_args$args;
}
}
}
- path: /etc/nginx/ssl/demo.clinicalgenome.org/server.chained.crt
content: |
-----BEGIN CERTIFICATE-----
MIIE9TCCA92gAwIBAgISESGDRQa0iryNOboBDUfJaqaSMA0GCSqGSIb3DQEBCwUA
MEwxCzAJBgNVBAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMSIwIAYD
VQQDExlBbHBoYVNTTCBDQSAtIFNIQTI1NiAtIEcyMB4XDTE1MDcxNDIzNTAyMFoX
DTE4MDcxNDIzNTAyMFowRzEhMB8GA1UECxMYRG9tYWluIENvbnRyb2wgVmFsaWRh
dGVkMSIwIAYDVQQDDBkqLmRlbW8uY2xpbmljYWxnZW5vbWUub3JnMIIBIjANB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