worker_processes auto; error_log /home/user/nginx/error.log warn; pid /home/user/nginx/nginx.pid; events { worker_connections 1024; } http { # Include the default mime types (includes .wasm, .js, etc.). include /etc/nginx/mime.types; default_type application/octet-stream; client_body_temp_path /home/user/nginx/tmp/client_body; proxy_temp_path /home/user/nginx/tmp/proxy; fastcgi_temp_path /home/user/nginx/tmp/fastcgi; uwsgi_temp_path /home/user/nginx/tmp/uwsgi; scgi_temp_path /home/user/nginx/tmp/scgi; access_log /home/user/nginx/access.log; # Hide nginx version server_tokens off; sendfile on; keepalive_timeout 65; # The main server block server { listen 8080 default_server; server_name _; # Serve the Unity WebGL build from /unity at the container root root /unity; index index.html; # Proxy /api/* to FastAPI running on localhost:3000 location /api/ { proxy_pass http://127.0.0.1:3000/; proxy_http_version 1.1; # For WebSocket/streaming support (if your FastAPI endpoints use it) proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; # Forward original Host header, useful for logs or domain-specific logic proxy_set_header Host $host; } # All other files are served from the Unity build # If file is not found, try returning index.html (useful for single-page apps) location / { try_files $uri $uri/ /index.html; } } }