-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnginx.conf.template
85 lines (69 loc) · 2.49 KB
/
nginx.conf.template
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
access_log /var/log/nginx/access.log combined;
upstream backend_api {
server backend:80;
}
server {
# use 'listen 80 deferred;' for Linux
# use 'listen 80 accept_filter=httpready;' for FreeBSD
client_max_body_size 4G;
# set the correct host(s) for your site
server_name api.domain.com;
keepalive_timeout 5;
location /api/ {
proxy_pass http://backend_api/api/;
add_header 'Access-Control-Allow-Origin' '*';
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
}
# backend's Swagger UI
location /docs {
proxy_pass http://backend_api/docs;
add_header 'Access-Control-Allow-Origin' '*';
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
}
# backend's static files for Swagger UI
location ~ /static/(swagger.*) {
proxy_pass http://backend_api/static/$1;
add_header 'Access-Control-Allow-Origin' '*';
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
}
location /lsf {
return 307 ${LABEL_STUDIO_OPEN_HOST}:${LABEL_STUDIO_OPEN_PORT};
}
# frontend entrypoint
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html =404;
}
# static files
location /ymir-assets/ {
rewrite ^(.*)a000000000(.*)$ $1$2 break;
types { } default_type "image/jpeg;";
root /data/ymir/;
}
location /ymir-models/ {
root /data/ymir/;
}
location /ymir-storage/ {
add_header Content-Disposition "attachment";
root /data/ymir/;
}
#error_page 500 502 503 504 /500.html;
#location = /500.html {
# root /path/to/app/current/public;
#}
#listen 443 ssl; # managed by Certbot
#ssl_certificate /etc/letsencrypt/live/api.domain.com/fullchain.p>
#ssl_certificate_key /etc/letsencrypt/live/api.domain.com/privkey>
#include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
#ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}