File size: 960 Bytes
9f7a5a6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
worker_processes auto;
pid /var/lib/nginx/nginx.pid;

events {
    worker_connections 1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;
    keepalive_timeout  65;

    # Define the FastAPI upstream server
    upstream fastapi_backend {
        server 127.0.0.1:7860;
    }

    server {
        listen 8501; 

        root /home/user/app/frontend/dist;

        index index.html index.htm;

        # Serve static files for the React app
        location / {
            try_files $uri $uri/ /index.html; 
        }

        # Proxy API requests to the FastAPI backend
        location /api/ {
            proxy_pass http://fastapi_backend/; 
            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-Proto $scheme;
           
        }
    }
}