-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnginx.conf
45 lines (37 loc) · 1.09 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
upstream app_server {
server django:8000 fail_timeout=0;
}
server {
listen 8080;
root /var/www/html;
access_log stdout;
error_log stderr;
location /static/ {
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Max-Age 3600;
add_header Access-Control-Expose-Header Content-Length;
add_header Access-Control-Allow-Headers Range;
if ($request_method = OPTIONS) {
return 204;
}
alias /static/;
}
# Route for nginx health check.
location /ng-health {
return 200;
}
try_files $uri @django;
location @django {
proxy_connect_timeout 30;
proxy_send_timeout 30;
proxy_read_timeout 30;
send_timeout 30;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# Do not set X-Forwarded-Proto if there's another
# front proxy capturing HTTPS traffic.
# proxy_set_header X-Forwarded-Proto $schema;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://app_server;
}
}