502 Bad Gateway nginx/1.10.3 (Ubuntu) - Angular app down - node.js

I have an website in Angular hosted on AWS. On my local machine, the app works with npm start. However, when I ssh and update the changes I get an 502 Bad Request Error. It looks like this might be a dependency issue. Do you know know to troubleshoot this?

Related

403 Squid error after successful deployment on elastic beanstalk

I'm stuck with the launching of my node.js server and client (nuxt) environments. After successful deployment, both of them started normally (saw that in logs), but I can't access them using a browser because of a 403 squid error.
How could this issue be sold?
A VPN service was activated in a browser, and this is why squid blocked me.

504 Gateway Timeout error with NuxtJS application running on Nginx

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.

Unable to fix NGINX 502: Bad Gateway error on a Digital Ocean droplet - Ubuntu 20.04

I have deployed my website to a Digital Ocean droplet (Ubuntu 20.04 server).
Everything was working fine. Today, I did some changes to the website in my local machine. So I pushed the changes to GitHub and then cloned the GitHub repo again to the server. Then, I installed the dependencies and restarted PM2.
Now, when I visit my site https://sundaray.io, I get the following error.
The following is the error log.
How can I fix the error?
Simple meaning is
No HTTP server response, your Node Http server is not answering requests.
502 gateway mean server and Nginx is getting your request but there is issue with upstream.
you can use the command to show the logs of pm2
pm2 show
the application might be crashing or internal server 500 error.

The Nginx server returns error 502 for some directories (Express Application)

I'm running an express application using nginx web server on Ubuntu. everything works fine but today when I added two more directories using app.get method and re-deploy my app, the new directories won't work and it returns 502 Bad Gateway errors (old directoriesn are working fine). Restarting pm2, nginx and the server itself didn't help. What should I do?
After a couple of hours I realized that the problem was in my code and not relevant to nginx. But because of pm2 the server would not crash to help me find that out.
running normal run command:
node server.js
revealed the mistake

502 Gateway Error on AWS - API

I am creating a test web app and have deployed it to AWS Ubuntu server using nginx..
I am getting a 502 Bad Gateway error when it tries to reach my API..
I am new to this and have started node.js and all seems to working fine except when I want to perform an API call to mongodb to read or write information. it is working fine locally so I am at a loss....
GET http://ec2-54-72-145-112.eu-west-1.compute.amazonaws.com/api/rest/golf 502 (Bad Gateway)
this is nginx server config
location /xxxxxxxxxxxxxxx{
alias /home/ubuntu/xxxxxxxxxxxxxx/site/public;
}
location /api/ {
proxy_pass http://127.0.x.1:8180/api/;
}
..
I know I may not be giving enough info but hopefully someone has an idea..
Thanks!
The nginx error message HTTP 502 indicates the nginx is working fine but cannot reach your specified proxy. So I'd suggest you to check whether the port and binding IP are correct.
You can check which ports are bound by which application using this command on your Ubuntu machine:
netstat -tulpen
You should see a line with the column "Local Address" and in your case the value 127.0.x.1:8180. If it's not there try to figure out which port is bound by your node application and reconfigure the nginx to use that port.

Resources