Nginx配置

nginx配置api、static

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
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}

location ^~ /api {
proxy_pass http://127.0.0.1:8000/api;
proxy_redirect off;

proxy_read_timeout 350s;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

location ^~ /static/upload_file {
proxy_pass http://127.0.0.1:8000/static/upload_file/;
proxy_redirect off;

proxy_read_timeout 350s;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

location ^~ /static {
proxy_pass http://127.0.0.1:8000/static;
proxy_redirect off;

proxy_read_timeout 350s;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}