forked from SelfhostedPro/Yacht
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nginx.conf
65 lines (54 loc) · 1.69 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
worker_processes 1;
user abc abc;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
### Set http options
# fallback in case we can't determine a type
default_type application/octet-stream;
access_log /var/log/nginx/access.log combined;
sendfile on;
keepalive_timeout 5;
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
upstream api_server {
server unix:/tmp/gunicorn.sock fail_timeout=0;
}
# Paths for Vue and FastAPI
server {
listen *:8000;
# Vue
location / {
root /app;
index index.html;
try_files $uri $uri/ /index.html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# FastAPI
location /api/ {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
# Set this so that the app updates function doesn't timeout
proxy_read_timeout 300s;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
client_body_temp_path /var/www/client_body_temp;
proxy_temp_path /var/www/proxy_temp;
# we don't want nginx trying to do something clever with
# redirects, we set the Host: header above already.
proxy_redirect off;
proxy_pass http://api_server/;
}
}
}