Spaces:
Paused
Paused
| worker_processes auto; | |
| pid /tmp/nginx.pid; | |
| events { | |
| worker_connections 1024; | |
| } | |
| http { | |
| include /etc/nginx/mime.types; | |
| default_type application/octet-stream; | |
| # Temp paths for non-root | |
| client_body_temp_path /tmp/nginx-client-body; | |
| proxy_temp_path /tmp/nginx-proxy; | |
| fastcgi_temp_path /tmp/nginx-fastcgi; | |
| uwsgi_temp_path /tmp/nginx-uwsgi; | |
| scgi_temp_path /tmp/nginx-scgi; | |
| sendfile on; | |
| tcp_nopush on; | |
| keepalive_timeout 65; | |
| gzip on; | |
| gzip_types text/plain text/css application/json application/javascript text/xml; | |
| # Logging | |
| access_log /tmp/nginx-access.log; | |
| error_log /tmp/nginx-error.log; | |
| server { | |
| listen 7860; | |
| server_name _; | |
| # Frontend static files | |
| root /app/frontend; | |
| index index.html; | |
| # API proxy → FastAPI | |
| 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; | |
| # Timeouts | |
| proxy_connect_timeout 10s; | |
| proxy_send_timeout 30s; | |
| proxy_read_timeout 30s; | |
| } | |
| # Health check | |
| location /health { | |
| proxy_pass http://127.0.0.1:8000; | |
| } | |
| # Frontend SPA fallback | |
| location / { | |
| try_files $uri $uri/ /index.html; | |
| } | |
| # Security headers (X-Frame-Options removed to allow HF Spaces iframe embedding) | |
| add_header X-Content-Type-Options "nosniff" always; | |
| add_header Referrer-Policy "strict-origin-when-cross-origin" always; | |
| } | |
| } | |