简体   繁体   English

连接到上游时连接()失败(111:连接被拒绝)。(节点/ nestjs)亚马逊弹性

[英]connect() failed (111: Connection refused) while connecting to upstream.(node / nestjs) amazon Elastic

Trying to deploy my first app (Back-end).尝试部署我的第一个应用程序(后端)。 But I meet an error of the type 502 Bad Gateway.但是我遇到了 502 Bad Gateway 类型的错误。

2022/04/16 09:40:14 [error] 4853#4853: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 172.31.46.123, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8081/", host: "172.31.12.175"
2022/04/16 09:40:16 [error] 4853#4853: *3 connect() failed (111: Connection refused) while connecting to upstream, client: 172.31.6.213, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8081/", host: "172.31.12.175"

This is my main.ts file:-这是我的 main.ts 文件:-

async function bootstrap() {
  const PORT = process.env.PORT || 8081;
  const app = await NestFactory.create(AppModule, { cors: true });
  app.useGlobalPipes(new ValidationPipe());
  const configService = app.get(ConfigService);
  app.enableCors();
  await app.listen(process.env.PORT || 8081, () => {
    console.log(`⛱ Talent Zea Cloud listening on port ${PORT}`);
    console.log('Press Ctrl+C to quit.');
  });
}
bootstrap();

EB uses port 8080 by default for node.js, but you are using port 8081 . EB 默认为 node.js 使用端口 8080 ,但您使用的是端口8081 So either change your port, or setup PORT env variable in EB to 8081 .因此,要么更改您的端口,要么将 EB 中的PORT env 变量设置为8081 From docs:来自文档:

By default, Elastic Beanstalk configures the proxy to forward requests to your application on port 8080 .默认情况下,Elastic Beanstalk 将代理配置为将请求转发到端口 8080 上的应用程序

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Django; 44 connect() 在连接到 AWS Elastic Bean 上的上游时失败(111:连接被拒绝) - Django; 44 connect() failed (111: Connection refused) while connecting to upstream on AWS Elastic Bean 111:连接到上游时连接被拒绝 - 111: Connection refused while connecting to upstream AWS EC2:(连接被拒绝)同时连接到上游 - AWS EC2: (Connection refused) while connecting to upstream 连接到上游 nginx for aws 时 connect() 失败(113:主机无法访问) - connect() failed (113: Host is unreachable) while connecting to upstream nginx for aws Django 'ModuleNotFoundError:部署到 Elastic Beanstalk 时没有名为'blog/wsgi' 的模块,以及'连接到上游时出错' - Django 'ModuleNotFoundError: No module named 'blog/wsgi' when deploying to Elastic Beanstalk, as well as 'Error while connecting to Upstream' EC2 实例 (Elastic Beanstalk) 上的 Amazon Cassandra 连接超时 - Amazon Cassandra connection timeout on EC2 instance (Elastic Beanstalk) 从上游读取响应 header 时上游超时(110:连接超时) - upstream timed out (110: Connection timed out) while reading response header from upstream Spring 启动连接 AWS java.net.ConnectException:连接被拒绝 - Spring boot connect AWS java.net.ConnectException: Connection refused 连接到 AWS DocumentDB 时出现连接错误 - connection error while connecting to AWS DocumentDB 如何排查 Amazon Connect CCP 错误“awsapps.com 拒绝连接” - How to troubleshoot Amazon Connect CCP error "awsapps.com refused to connect"
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM