I have created a new server redash in aws Region us-west-2.
after a setup superset in server but error. I reboot server instance in aws and redash don't active.
Bad Gateway: The proxy server received an invalid response from an
upstream server HTTP Error 502 - Bad Gateway
check error in cat /var/log/nginx/error.log I see:
2018/09/27 17:33:06 [error] 1192#1192: *16 recv() failed (104:
Connection reset by peer) while reading response header from upstream,
client: 210.245.121.234, server: , request: "GET / HTTP/1.1",
upstream: "http://127.0.0.1:5000/", host: "54.191.135.96" 2018/09/27
17:33:06 [error] 1192#1192: *16 connect() failed (111: Connection
refused) while connecting to upstream, client: 210.245.121.234,
server: , request: "GET /favicon.ico HTTP/1.1", upstream:
"http://127.0.0.1:5000/favicon.ico", host: "54.191.135.96", referrer:
"http://54.191.135.96/"
Did you add your redash start command in your /etc/init.d/ configuration ?
A simple installation on a Ec2 Server will not do that for you, you have to ask your ec2 to launch redash on startup process
There is multiple ways to do that, AWS User data is one of them, try this out?
(If not, please provide us more information about your system and how you launch your redash)
Related
I'm running spring boot with aws elastic beanstalk but when I deploy it , it errored as 502 bad gateway.
I have tried all the solutions related to this error
I have changed the SERVER_PORT to 5000
I have changed the security inbound rules in RDS and EC2 TCP 5000 anywhere
here are the last 100 logs errors:
2021/11/18 02:00:29 [error] 15036#15036: *5 connect() failed (111: Connection refused) while connecting to upstream, client: 94.129.70.0, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:5000/", host: "rentedbooksapi-env-1.eba-pddpv5ew.eu-central-1.elasticbeanstalk.com"
2021/11/18 02:00:29 [error] 15036#15036: *7 connect() failed (111: Connection refused) while connecting to upstream, client: 94.129.70.0, server: , request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:5000/favicon.ico", "
Any idea on how to resolve this issue?
I am attempting to deploy a locally developed web application as an aws instance. The application is web based with a node.js back end. I uploaded the application using aws's Elastic Beanstalk which is pretty straightforward and worked well. I received a green health checkmark after the deployment was completed.
However, when I selected the url at the top of the Dashboard to open my newly deployed app, I received a '502 Bad Gateway' error. I did a Google search to identify what the error was and how to correct it without much success. Most of the suggestions were to refresh the page and it would somehow go away 'by itself'. It didn't. I also read through the Elastic Beanstalk war - 502 Bad Gateway stackoverflow question also without much success.
Here is the output of the error.log that I downloaded from aws:
2018/10/11 15:04:24 [error] 2946#0: *231 connect() failed (111:
Connection refused) while connecting to upstream, client: 172.31.88.17,
server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8081/",
host: "sowapp-env.bpcts5p34k.us-east-1.elasticbeanstalk.com"
2018/10/11 15:04:24 [error] 2946#0: *231 connect() failed (111:
Connection refused) while connecting to upstream, client: 172.31.88.17,
server: , request: "GET /favicon.ico HTTP/1.1", upstream:
"http://127.0.0.1:8081/favicon.ico", host: "sowapp-env.bpcts5p34k.us-east-1.elasticbeanstalk.com", referrer: "http://sowapp-env.bpcts5p34k.us-east-1.elasticbeanstalk.com/"
2018/10/11 15:05:13 [error] 2946#0: *231 connect() failed (111: Connection refused) while connecting to upstream, client: 172.31.88.17, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8081/", host: "sowapp-env.bpcts5p34k.us-east-1.elasticbeanstalk.com"
2018/10/11 15:05:13 [error] 2946#0: *231 connect() failed (111: Connection refused) while connecting to upstream, client: 172.31.88.17, server: , request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:8081/favicon.ico", host: "sowapp-env.bpcts5p34k.us-east-1.elasticbeanstalk.com", referrer: "http://sowapp-env.bpcts5p34k.us-east-1.elasticbeanstalk.com/"
I also downloaded the nodejs.log which seems to indicate that the aws server is not pointing to the startup file, server.js.
Error: Cannot find module '/var/app/current/system.js'
at Function.Module._resolveFilename (module.js:476:15)
at Function.Module._load (module.js:424:25)
at Module.runMain (module.js:611:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:160:9)
at bootstrap_node.js:507:3
module.js:478
throw err;
Suggestions are appreciated.
Thanks...
I would try this.
Set up a folder in your source your uploading to elastic beanstalk called .ebextensions
Create the files here to set your source and setup your application.
An example is creating a file called node-settings.config
(to run any npm commands your application needs to initialize) Example \/ from the link:
option_settings:
aws:elasticbeanstalk:container:nodejs:
NodeCommand: "npm start"
ProxyServer: apache
GzipCompression: true
aws:elasticbeanstalk:container:nodejs:staticfiles:
/images: myimages
Here is the link to show what you can set as Platform Specific Options in this file (nodejs):
https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/command-options-specific.html
In my case, I tried changing the node.js port to 8081 and committed on local branch. Thereafter doing eb deploy from command line deployment solved my problem.
I'm running a jetty REST server on AWS - Elastic Beanstalk, with nginx.
The application is running using the Dropwizard framework.
Recently, I've upgraded Dropwizard from version 1.2.2 to 1.3.5.
Then, some of my integration tests started to fail occasionally with Bad Gateway response.
These are the sort of errors I see in nginx error.log:
2018/08/14 05:03:07 [error] 12897#0: *11330 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 10.30.xx.xx, server: , request: "POST /some_url HTTP/1.1", upstream: "http://127.0.0.1:8080/some_url", host: "some_host.local"
2018/08/14 07:37:02 [error] 18575#0: *13099 writev() failed (104: Connection reset by peer) while sending request to upstream, client: 10.30.xx.xx, server: , request: "POST /some_url HTTP/1.1", upstream: "http://127.0.0.1:8080/some_url", host: "some_hostname"
The Dropwizard upgrade changed the jetty version from 9.4.7.v20170914 to 9.4.11.v20180605.
Jersey client remained the same version: 2.25.1
It seems that there were some "Bad Gateway" before the upgrade, but their number increased significantly.
I cannot imagine right now why this upgrade should have cause this, so I'm open for your ideas.
The problem is discussed here: https://github.com/dropwizard/dropwizard/issues/2461
The suggested solutions are:
Use a stronger machine instance in EC2.
Manually increase the value of the configuration parameter "acceptQueueSize" to a higher value than the OS default (suggested: 256)
I'm very new to AWS in general, and I'm trying to deploy a Spring Boot application through Elastic Beanstalk.
However, the logs show the following errors:
2017/12/24 05:16:53 [error] 3114#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 172.31.18.82, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:5000/", host: "172.31.15.157"
2017/12/24 05:16:53 [error] 3114#0: *2 connect() failed (111: Connection refused) while connecting to upstream, client: 172.31.7.216, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:5000/", host: "172.31.15.157"
And these errors continue for a little bit...
I've searched around for this issue (on Stack Overflow and other forums), and they all suggest that the server port needs to be changed to 5000.
I've done that by setting the environment variable SERVER_PORT to 5000, and it looks like the spring boot app is starting properly in the correct port because the following is displayed in the logs:
2017-12-24 19:40:16.239 INFO 20086 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 5000 (http)
So the port is not the issue.
I did build the environment in a VPC, and so I figured it might be a security group causing this issue. So I (temporarily) allowed all traffic for incoming rules and outgoing rules for the VPC Security Group and the Load Balancer Security Group. This didn't make a difference either.
Right now, I'm pretty much stumped and don't know what else to try.
It turns out that it was just a dumb error on my part. The URL I had configured to the Elastic Beanstalk for the health check was protected by Spring Security.
So I just opened up an endpoint which is not protected, and everything works fine.
I am deploying a django webapp on digitalocean and I am using Nginx and Gunicorn.
And when I open my url, it shows 502 bad gateway.
In the nginx_errors.log, I find the following error message:
[error] 12229#0: *1 connect() to unix:/home/demo/webapps/hello/run/gunicorn.sock failed (111: Connection refused) while connecting to upstream, client: 123.45.6.78, server: demohello.com, request: "GET / HTTP/1.1", upstream: "http://unix:/home/demo/webapps/hello/run/gunicorn.sock:/", host: "demohello.com"
Is it because my nginx configuration is wrong? How to fix it?
You need to set the configurations for gunicorn correctly which is in /etc/init/gunicorn.conf.
Be careful with:
--name=django_project \
--pythonpath=django_project \
django_project.wsgi:application