Replace `Host $host` with `Host $http_host` so the upstream application receives the original host including the port (e.g. `manyfold:8081`).
Add `X-Forwarded-Host` and `X-Forwarded-Port` headers to ensure the Rails app generates correct absolute URLs instead of defaulting to port 80 when running behind nginx on a non-standard port.