awacke1 commited on
Commit
99360c1
Β·
verified Β·
1 Parent(s): db833a2

Update nginx.conf

Browse files
Files changed (1) hide show
  1. nginx.conf +5 -15
nginx.conf CHANGED
@@ -1,16 +1,8 @@
1
- # nginx.conf πŸ§™β€β™‚οΈβœ¨ (one port to rule them all: 7860)
2
- worker_processes 1;
3
-
4
- events { worker_connections 1024; }
5
 
6
  http {
7
- sendfile on;
8
- tcp_nopush on;
9
- tcp_nodelay on;
10
-
11
- # logs off = quieter (and less β€œwhy are we yelling?”)
12
  access_log off;
13
- error_log /dev/stderr warn;
14
 
15
  upstream fastapi_upstream { server 127.0.0.1:8000; }
16
  upstream streamlit_upstream { server 127.0.0.1:8501; }
@@ -18,26 +10,24 @@ http {
18
  server {
19
  listen 7860;
20
 
21
- # βœ… FastAPI JSON endpoints
22
  location /api/ {
23
  proxy_pass http://fastapi_upstream/;
24
  proxy_set_header Host $host;
25
  proxy_set_header X-Forwarded-Proto $scheme;
26
  }
27
 
28
- # βœ… Streamlit admin console (websocket-y)
29
  location /admin/ {
30
  proxy_pass http://streamlit_upstream/;
31
  proxy_http_version 1.1;
32
  proxy_set_header Host $host;
33
-
34
- # Websocket headers πŸ”Œ
35
  proxy_set_header Upgrade $http_upgrade;
36
  proxy_set_header Connection "upgrade";
37
  proxy_read_timeout 86400;
38
  }
39
 
40
- # Root -> admin (because β€œwhere am I?” should be answered kindly πŸ˜„)
41
  location = / { return 302 /admin/; }
42
  }
43
  }
 
1
+ worker_processes 1;
2
+ events { worker_connections 1024; }
 
 
3
 
4
  http {
 
 
 
 
 
5
  access_log off;
 
6
 
7
  upstream fastapi_upstream { server 127.0.0.1:8000; }
8
  upstream streamlit_upstream { server 127.0.0.1:8501; }
 
10
  server {
11
  listen 7860;
12
 
13
+ # /api/* -> FastAPI (BUT /api prefix is removed before forwarding)
14
  location /api/ {
15
  proxy_pass http://fastapi_upstream/;
16
  proxy_set_header Host $host;
17
  proxy_set_header X-Forwarded-Proto $scheme;
18
  }
19
 
20
+ # /admin/* -> Streamlit
21
  location /admin/ {
22
  proxy_pass http://streamlit_upstream/;
23
  proxy_http_version 1.1;
24
  proxy_set_header Host $host;
 
 
25
  proxy_set_header Upgrade $http_upgrade;
26
  proxy_set_header Connection "upgrade";
27
  proxy_read_timeout 86400;
28
  }
29
 
30
+ # root -> admin (because humans love buttons more than endpoints πŸ˜„)
31
  location = / { return 302 /admin/; }
32
  }
33
  }