forked from LearningLocker/learninglocker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nginx.conf.example
83 lines (69 loc) · 2.14 KB
/
nginx.conf.example
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
upstream llxapi {
# fail_timeout=0 means we always retry an upstream even if it failed
# to return a good HTTP response
#server learninglocker-xapi:8080 fail_timeout=10 max_fails=20;
server learninglocker-xapi:8080 fail_timeout=0;
}
server {
listen 80 default_server;
listen [::]:80 default_server;
server_tokens off;
access_log /var/log/nginx/access.log;
# Max request size
client_max_body_size 20M;
large_client_header_buffers 4 256k;
root /learninglocker/public;
## from: https://serverfault.com/a/710578 and https://testdriven.io/blog/deploying-django-to-ecs-with-terraform/
location /healthcheck {
access_log off;
return 200 'A-OK!';
# because default content-type is application/octet-stream,
# browser will offer to "save the file"...
# the next line allows you to see it in the browser so you can test
add_header Content-Type text/plain;
}
# xAPI endpoints
location ~* ^/data/xAPI(.*)$ {
proxy_pass http://llxapi/data/xAPI$1$is_args$args;
}
# API endpoints
location = /api {
rewrite /api / break;
proxy_redirect off;
proxy_pass http://learninglocker-api:8080;
}
location ~* ^/api(.*)$ {
proxy_pass http://learninglocker-api:8080$1$is_args$args;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
# All other traffic directed to statics or Node server
location / {
try_files $uri @node_server;
}
# Node UI server
location @node_server {
proxy_pass http://learninglocker-clientserver:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
# Load configuration files for the default server block.
error_page 404 /404.html;
location = /40x.html {
root /usr/share/nginx/html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# We don't need .ht files with nginx.
location ~ /\.ht {
deny all;
}
}