events {} http { include mime.types; default_type application/octet-stream; gzip off; # disable gzip if you're using Brotli-precompressed files server { listen 7860; server_name localhost; root /usr/share/nginx/html; location / { index index.html; try_files $uri $uri/ =404; } # Serve .br files location ~* \.(br)$ { add_header Content-Encoding br; add_header Vary Accept-Encoding; default_type application/octet-stream; } # Serve Brotli-compressed Unity files based on extension location ~* \.wasm\.br$ { add_header Content-Type application/wasm; add_header Content-Encoding br; add_header Vary Accept-Encoding; } location ~* \.js\.br$ { add_header Content-Type application/javascript; add_header Content-Encoding br; add_header Vary Accept-Encoding; } location ~* \.data\.br$ { add_header Content-Type application/octet-stream; add_header Content-Encoding br; add_header Vary Accept-Encoding; } location ~* \.unityweb\.br$ { add_header Content-Type application/octet-stream; add_header Content-Encoding br; add_header Vary Accept-Encoding; } # Optional: set long cache headers for Unity build files location ~* \.(js|data|wasm|unityweb)(\.br)?$ { expires 1y; access_log off; } } }