-
Notifications
You must be signed in to change notification settings - Fork 0
/
nginx.conf
executable file
·183 lines (148 loc) · 6.08 KB
/
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
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
181
182
183
# qed.epa.gov redirect to HTTPS/SSL
server {
listen 80;
server_name qed.epa.gov;
#return 301 https://$server_name$request_uri;
return 301 https://$host$request_uri;
}
# qedinternal.epa.gov redirect to HTTPS/SSL
server {
listen 80;
server_name qedinternal.epa.gov;
#return 301 https://$server_name$request_uri;
return 301 https://$host$request_uri;
}
# qed.epa.gov django front-end HTTPS/SSL
server {
#listen [::]443;
listen 443;
server_name qed.epa.gov;
client_max_body_size 20M;
client_body_buffer_size 20M;
# HSTS Policy (max-age=60 == 1 min. 31536000 = 1 year)
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
ssl on;
#qed physical location of_certificate /var/www/nginx/certs/qed.epa.gov.chained.crt;
#qed physical location of key /var/www/nginx/certs/qed.key;
ssl_certificate /etc/nginx/qed/qed.epa.gov.chained.crt;
ssl_certificate_key /etc/nginx/qed/qed.key;
#ssl_certificate /etc/nginx/qed/qed.epa.gov.chained.crt;
#ssl_certificate_key /etc/nginx/qed/qed.key;
#ssl_certificate_key /etc/nginx/qed/qedinternal.key;
ssl_session_timeout 5m;
#disable ssl2 and ssl3 per
#https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
#older commented out security block
#ssl_protocols SSLv3 TLSv1;
#ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+EXP;
#ssl_prefer_server_ciphers on;
location /static_qed/ {
alias /src/collected_static/;
}
location / {
try_files $uri @uwsgi_django;
}
location @uwsgi_django {
include uwsgi_params;
uwsgi_pass uwsgi_django:8080; # 'uwsgi_django' is the hostname given in Docker-Compose YAML 'links' section
proxy_read_timeout 600;
proxy_send_timeout 600;
uwsgi_read_timeout 600s;
uwsgi_send_timeout 600s;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# HSTS Policy (max-age=60 == 1 min), 31536000 = 1 year Unknown if proxy_set_header disables inheritance like add_header
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
}
# nodejs/socket.io route:
location /socket.io {
proxy_pass http://cts_nodejs:4000; # is this hard-coded port necessary?
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
}
}
# qedinternal.epa.gov django front-end HTTPS/SSL
server {
#listen [::]443;
listen 443;
server_name qedinternal.epa.gov;
client_max_body_size 2M;
# HSTS Policy (max-age=60 == 1 min, 31536000 = 1 year)
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
ssl on;
#qed physical location of_certificate /var/www/nginx/certs/qed.epa.gov.chained.crt;
#qed physical location of key /var/www/nginx/certs/qed.key;
ssl_certificate /etc/nginx/qed/qed.epa.gov.chained.crt;
ssl_certificate_key /etc/nginx/qed/qed.key;
#ssl_certificate /etc/nginx/qed/qed.epa.gov.chained.crt;
#ssl_certificate_key /etc/nginx/qed/qed.key;
#ssl_certificate_key /etc/nginx/qed/qedinternal.key;
ssl_session_timeout 5m;
#disable ssl2 and ssl3 per
#https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
#older commented out security block
#ssl_protocols SSLv3 TLSv1;
#ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+EXP;
#ssl_prefer_server_ciphers on;
location /static_qed/ {
alias /src/collected_static/;
}
location / {
try_files $uri @uwsgi_django;
}
location @uwsgi_django {
include uwsgi_params;
uwsgi_pass uwsgi_django:8080; # 'uwsgi_django' is the hostname given in Docker-Compose YAML 'links' section
proxy_read_timeout 600;
proxy_send_timeout 600;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# HSTS Policy (max-age=60 == 1 min), Unknown if proxy_set_header disables inheritance like add_header
add_header Strict-Transport-Security "max-age=60; includeSubDomains" always;
}
# nodejs/socket.io route:
location /socket.io {
proxy_pass http://cts_nodejs:4000; # is this hard-coded port necessary?
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
}
# flower celery monitor
# location /flower/ {
# rewrite ^/flower/(.*)$ /$1 break;
# proxy_pass http://uwsgi_flower:5555;
# proxy_set_header Host $Host;
# }
}
# Flask back-end
server {
#listen [::]7777;
listen 7777;
# HSTS Policy (max-age=60 == 1 min, 31536000 = 1 year)
# add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
location / {
try_files $uri @uwsgi_flask;
}
location @uwsgi_flask {
include uwsgi_params;
uwsgi_pass uwsgi_flask:8080; # 'uwsgi_flask' is the hostname given in Docker-Compose YAML 'links' section
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# HSTS Policy (max-age=60 == 1 min 31536000 = 1 year), Unknown if proxy_set_header disables inheritance like add_header
# add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
}
}