OptiQ / nginx /nginx.conf
mohammademad2003's picture
first commit
7477316
server {
listen 80;
server_name _;
# ── React SPA ─────────────────────────────────
root /usr/share/nginx/html;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
# ── FastAPI proxy ─────────────────────────────
location /api/ {
proxy_pass http://api:8000/api/;
proxy_http_version 1.1;
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;
proxy_read_timeout 120s;
proxy_send_timeout 120s;
}
# ── FastAPI docs (optional) ───────────────────
location /docs {
proxy_pass http://api:8000/docs;
proxy_set_header Host $host;
}
location /openapi.json {
proxy_pass http://api:8000/openapi.json;
proxy_set_header Host $host;
}
# ── Gzip ──────────────────────────────────────
gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml;
gzip_min_length 256;
}