user root; worker_processes auto; pid /tmp/nginx.pid; error_log /tmp/nginx_error.log warn; events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; access_log /tmp/nginx_access.log; client_body_temp_path /tmp/client_body; proxy_temp_path /tmp/proxy_temp; fastcgi_temp_path /tmp/fastcgi_temp; uwsgi_temp_path /tmp/uwsgi_temp; scgi_temp_path /tmp/scgi_temp; sendfile on; keepalive_timeout 65; client_max_body_size 100M; # Main server on port 7860 (Hugging Face expects this) server { listen 7860; server_name _; # Frontend (Next.js) location / { proxy_pass http://localhost:3001; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; } # Backend WebSocket location /ws { proxy_pass http://localhost:8000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $host; proxy_read_timeout 86400; } # Backend API location /api { proxy_pass http://localhost:8000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; } # Avatar TTS location /speak { proxy_pass http://localhost:8765; proxy_set_header Host $host; } location /static { proxy_pass http://localhost:8765; proxy_set_header Host $host; } # Health check location /health { proxy_pass http://localhost:8000/health; proxy_set_header Host $host; } } }