编程语言
首页 > 编程语言> > 连接到上游时connect()失败(111:连接被拒绝). Java(SparkJava)亚马逊弹性

连接到上游时connect()失败(111:连接被拒绝). Java(SparkJava)亚马逊弹性

作者:互联网

试图部署我的第一个应用程序(后端).
但我遇到502 Bad Gateway类型的错误.

2016/05/03 14:46:14 [error] 2247#0: *19 connect() failed (111: Connection refused) while connecting to upstream, client: 172.31.43.183, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:5000/", host: "myHost.eu-west-1.elasticbeanstalk.com"
2016/05/03 14:50:23 [error] 2566#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 172.31.8.36, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:5000/", host: "myHost.eu-west-1.elasticbeanstalk.com"
2016/05/03 14:55:04 [error] 2566#0: *61 connect() failed (111: Connection refused) while connecting to upstream, client: 172.31.43.183, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:5000/", host: "myHost.eu-west-1.elasticbeanstalk.com"

我用于我的后端框架SparkJava,它在端口4567上启动.
因此,我扩展了Nginx(nginx / 1.8.1)的配置.但问题始终存在.

server {
    listen 4567 default_server;
    listen [::]:4567 default_server ipv6only=on;
}

有关信息:我的后端与数据库通信(RDS aws amazon)

解决方法:

从您的日志:上游:“http://127.0.0.1:5000/”我看到,nginx正在尝试连接到同一台机器上的5000端口,它拒绝连接.什么在5000端口上运行?你可能需要研究一下.

标签:nginx,java,amazon-web-services,spark-java,amazon-elastic-beanstalk
来源: https://codeday.me/bug/20190628/1311613.html