File size: 1,596 Bytes
f61f6a3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5849d84
 
f61f6a3
 
 
 
 
 
 
5aed951
 
 
 
 
 
 
 
 
 
 
 
 
 
f61f6a3
 
 
 
 
 
 
 
 
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
worker_processes 1;
error_log /tmp/nginx_error.log;
pid /tmp/nginx.pid;

events { worker_connections 512; }

http {
    include /etc/nginx/mime.types;
    client_body_temp_path /tmp/nginx_client;
    proxy_temp_path /tmp/nginx_proxy;
    fastcgi_temp_path /tmp/nginx_fastcgi;
    uwsgi_temp_path /tmp/nginx_uwsgi;
    scgi_temp_path /tmp/nginx_scgi;
    access_log /tmp/nginx_access.log;

    server {
        listen 7860;
        server_name _;

        location /api/ {
            proxy_pass http://127.0.0.1:8000;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_read_timeout 300;
            proxy_send_timeout 300;
            proxy_connect_timeout 30;
            client_max_body_size 100m;
        }

        location /health {
            proxy_pass http://127.0.0.1:8000/health;
        }

        # Route FastAPI Swagger Docs correctly
        location /docs {
            proxy_pass http://127.0.0.1:8000/docs;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
        }

        # Route OpenAPI schema for Swagger
        location /openapi.json {
            proxy_pass http://127.0.0.1:8000/openapi.json;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
        }

        location / {
            proxy_pass http://127.0.0.1:3000;
            proxy_set_header Host $host;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
        }
    }
}