I have a problem regarding my Node app that I am running in AWS. Everything has been working fine until today.
Without any new deployment to the app, I am getting this 502 error when I try to access the URL.
I have checked the nginx logs, and Im getting this:
2020/10/11 01:24:55 [error] 4735#0: *1 connect() failed (111: Connection refused) while connecting to upstream, server: , request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:8080/favicon.ico", host: "mydomain.com", referrer: "mydomain.com"
I have tried to create a new security group with new inbound rules but it didnt work, has there been ane "new" update on EB configuration Im missing?
Thanks in advance.
enter image description hereIf you are using python > 3.6 on eb. Then eb will use gunicorn to run your django app.
So you need to install gunicorn with pip install gunicorn also mention it in requirements.txt with pip freeze requirements.txt and most important thing is You need to create "Procfile" in your project root where manage.py is located.
"Procfile" will have no extension.
"Procfile" content is below:
web: gunicorn --bind :8000 --workers 3 --threads 2 ebdjango.wsgi:application
in place of ebdjango put you project name and deploy with eb deploy.
Thanks!
I got exactly the same problem exactly at the same time than you. My solution was to remove the start of the program from index.js to the app.js. After that everything works fine again. For the some reason aws does not start index.js file anymore.
Related
I have a Nuxt JS SSR site hosted on digital ocean. I am using nginx as reverse proxy with configuration as described at Nuxtjs website. I also use pm2 to run nuxt app. Everything works fine until I gat 504 and 502 errors. When I check ngnix logs it shows erros like this:
"[error] 2767773#2767773: *1655282 upstream timed out (110: Connection
timed out) while reading response header from upstream, client:
x.x.x.x, server: leadersport.ge, request: "GET /news/devils HTTP/1.1",
upstream: "http://x.x.x.x:8000/xxxx/xxxx", host: "xxx.com"
It seems like there is problem with Nuxtjs app. I inspected my Nuxtjs application(I use pm2 monit, and also I log every error inside my nuxtjs app) but it seems to work fine. After 504 error I check nuxtjs logs and there seems to be no problem. Could it be that I miss something regarding nuxtjs app? If so how could I find out what is exactly the problem with nuxtjs app? Or could it be the problem with nginx configuration?
I also check memory and cpu usage and it seems to be okay.
I am using the following link to setup kubernetes environment and run a containers in kubernetes.
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux_atomic_host/7/html/getting_started_with_kubernetes/get_started_orchestrating_containers_with_kubernetes
However,when I run "kubectl create -f db-service.yaml" as mentioned in section 1.3.3 - step 5, am getting "The connection to the server localhost:8080 was refused - did you specify the right host or port?".
Can you help if am missing anything, any suggestion is appreciated.
I've been trying to deploy my Node project on a brand new DO droplet, but i'm having some problems with PM2.
My steps are a follows:
Node came installed on the Droplet image (Ubuntu, Node v4.4.4)
Installed PM2 globally
Setup Nginx to reverse proxy 127.0.0.1:3000
Cloned my project and did npm install
All i get is Nginx complaining about a 502 Bad Gateway.
If i look at the Nginx error.log i get this:
connect() failed (111: Connection refused) while connecting to
upstream, client: client.ip, server: my.server, request:
"GET / HTTP/1.1", upstream: "http://127.0.0.1:3000/", host:
"my.server"
PM2 doesn't have much to say about anything. Nothing in pm2 logs and status is online.
I tried skipping PM2 and just doing npm start which worked perfectly. I also tried setting up a dummy hello world application instead, and using that with PM2 - it also worked.
So this is currently where i'm at:
My project + PM2: doesn't work.
My project without PM2: works.
Hello World app + PM2: works.
I'm not really sure where to go from here.. I could just skip PM2 and use node, but i do want the features of PM2.
Any ideas?
I just had to start PM2 with bin/www instead of app.js. Express generator and everything...
Nginx has a directive called proxy_read_timeout which defaults to 60 secs. It determines how long nginx will wait to get the response to a request. In nginx. conf file, setting proxy_read_timeout to 120 secs solved our problem.
In my case I renamed app.js to project.js or something and it works.
This is some issue with the node installation. Delete the node_modules folder, install again using npm and start the project using pm2.
pm2 kill
rm -rf node_modules
npm i
pm2 start bin/www
I am trying to get a deployment of a MEAN stack app using angular2 v1.0.0 beta.3 up and running. Everything is going well so far except this annoying routing issue that did NOT occur when I deployed to Heroku. However; this is my first experience deploying to ec2 using elastic beanstalk.
When I open up the route at the base route / the page loads as normal and I can use the app as if nothing is wrong. However, if I navigate to a subroute, in my case /client/issue/:id , the state loads, but if I reload the page I will get a 404 ERROR. In my server.js I have what I thought was a 404 catch app.get('*', loadIndex'), but this does not seem to be the case. I assume it is an issue with the way ec2 handles routing, but I am not sure.
EDIT
It might also be worth noting that I am only getting an error in my /var/log/nginx/error.log file and not the /var/log/nodejs/nodejs.log file.
From the error.log file:
2016/04/06 15:14:00 [error] 18952#0: *16 open() "/var/app/current/client/Issue/yes/57044092fe1924e77d9049ab" failed (2: No such file or directory), client: 172.31.4.202, server: , request: "GET /client/Issue/yes/57044092fe1924e77d9049ab HTTP/1.1",
I followed the instructions here http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_nodejs_express.html and it works fine if I use the aws examples.
But when I tried it by myself, the basic Express skeleton, expected to give an output of "Express \n Welcome to Express", isn't working and is giving a 502 Bad Gateway error.
I noticed that my build is with Express 4.2 whereas the aws examples use Express 3.x.
From the beanstalk logs:
2014/06/28 03:41:57 [error] 1930#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: xxx.xx.xxx.xx, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8081/", host: "my-env-xxxxxxxxxn.elasticbeanstalk.com"
There is no database, and no code changed from the skeleton generated by express.
(And btw, it works just fine if I do a npm start locally on my mac)
Please help.
Update: The solution mentioned in the link below answer works in this case.
502 Bad Gateway Deploying Express Generator Template on Elastic Beanstalk
Though it is not clear to me exactly why AWS would execute in that order.