Builder api Upstream Error

Ubuntu 18.04 Ec2 instance (2GB)

I am setting on Premise habitat in my ec2 instance (for testing). I have set up everything. but when I sign up with Github it shows the following error.
Screenshot from 2021-10-21 15-04-50

Console shows bad gateway 502 error.

I checked for the log file in builder-API-proxy this is the error that I get.
[error] 8540#0: *56 recv() failed (104: Connection reset by peer) while reading response header from upstream,
request: "GET /v1/authenticate/<github_secret HTTP/1.1"
Upstream is pointing to http://instance_ip:9636/v1/authenticate/<github_secret>

Same error Arise when I search for package name in /pkgs/core url.

This is the error which I see in systemctl status.

hab[22771]: at ./root/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.24/src/runtime/handle.rs:76:9
hab[22771]: builder-api.default(O): 50: tokio::runtime::Runtime::block_on
hab[22771]: builder-api.default(O): at ./root/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.24/src/runtime/mod.rs:441:9
hab[22771]: builder-api.default(O): 51: tokio::task::local::LocalSet::block_on
hab[22771]: builder-api.default(O): at ./root/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.24/src/task/local.rs:353:9
hab[22771]: builder-api.default(O): 52: actix_rt::runtime::Runtime::block_on
hab[22771]: builder-api.default(O): at ./root/.cargo/registry/src/github.com-1ecc6299db9ec823/actix-rt-1.1.1/src/runtime.rs:89:9
hab[22771]: builder-api.default(O): 53: actix_rt::arbiter::Arbiter::new::{{closure}}
hab[22771]: builder-api.default(O): at ./root/.cargo/registry/src/github.com-1ecc6299db9ec823/actix-rt-1.1.1/src/arbiter.rs:137:31
hab[22771]: builder-api.default(O): note: Some details are omitted, run with RUST_BACKTRACE=full for a verbose backtrace

If you could pls review: on-prem-builder/builder-oauth.md at main · habitat-sh/on-prem-builder · GitHub .

I already tried this 2-3 times but no luck. also followed the troubleshoot instruction.

sudo hab svc status shows everything working(up state). but there is some connection problem between habitat builder proxy and builder.