RunpodR
Runpod9mo ago
Rice

NGINX, Uvicorn and FastAPI setup not working

I'm going to put as much information here because I'm so lost and hopefully it makes helping me easier.

I've got an uvicorn server running and have verified it works when I ssh into the pod.
INFO:     Started server process [748]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)

Here's my nginx config
server {
    listen 8888;
    server_name 213.144.200.206;
    location / {
        proxy_pass http://127.0.0.1:8000;
        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;
    }
}

I've put that into /etc/nginx/sites-available/ and made a symlink to /etc/nginx/sites-enabled/

netstat gives this
ss -tuln | grep :8000
tcp   LISTEN 0      2048         0.0.0.0:8000       0.0.0.0:*          
root@8eccca76db93:/workspace# ss -tuln | grep :8888

So I can see the uvicorn server is listening, but nginx isn't listening on 8888

I've configured my pod to expose tcp port 8888
image.png
image.png
Was this page helpful?