oc-p09-street-vision-poc/nginx.conf

57 lines
1.9 KiB
Nginx Configuration File

# This reverse proxy configuration aims to make calls to different services running under different ports (Streamlit :8501 and FastAPI :8000) by calling only one port : the nginx one (configurable via NGINX_PORT)
# The NGINX_PORT has to be opened (Dockerfile) and used by app.py (streamlit) in order to make right calls.
worker_processes 1;
events { worker_connections 1024; }
http {
# ✅ AJOUT: Limite d'upload augmentée
client_max_body_size 200M; # Permet uploads jusqu'à 200MB
server {
listen ${NGINX_PORT};
# ✅ AJOUT: Timeouts pour gros fichiers
client_body_timeout 60s;
client_header_timeout 60s;
keepalive_timeout 60s;
send_timeout 60s;
location /api/ {
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;
# ✅ AJOUT: Timeouts pour uploads
proxy_read_timeout 300s;
proxy_connect_timeout 75s;
proxy_send_timeout 300s;
}
location / {
proxy_pass http://127.0.0.1:8501/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
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;
# ✅ AJOUT: Timeouts pour Streamlit uploads
proxy_read_timeout 300s;
proxy_connect_timeout 75s;
proxy_send_timeout 300s;
}
location /health {
return 200 'OK';
add_header Content-Type text/plain;
}
}
}