cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted

502 Bad Gateway

Hello there. I have recently bought a Linux VPS - not from GoDaddy. I have set up a Node.js website on the VPS and decided to buy a domain. I went to GoDaddy and bought one. I decided to forward my domain to my VPS IP address and port. Right now, the website is ONLY accessible via the IP:Port. After entering everything needed for the forwarding to work - masking was, of course on; I waited for 48 hours for the website to fully update. After 48 hours, I went to my domain and got a blank page saying: "[IP] refused to connect.". I thought my VPS firewall didn't allow my port to be accessable, so I allowed that port to be accesable using a simple command. That didn't work. Still the same thing. I sometimes get an nginx page saying: "502 Bad Gateway". Can someone help me with this?

5 REPLIES 5
Highlighted
Super User I
Super User I

Re: 502 Bad Gateway

Hello @vanishedvan ,

 

It sounds like you have NGINX configured as the front-end and Node.js as the back-end. 

 

You might check your site-available file on NGINX.

/etc/nginx/sites-available/example.com

And of course, check the Node.js file as well.

/var/www/example.com/server.js

I'm assuming your NGINX is set up on one port (80) and Node.js is set up on another port (3000). 

 

Check out this great Linode article about how to install Node.js and NGINX. I've used a lot of Linode documents in my help of creating VPS's.

 

Hopefully, this was helpful. 

 

 


Very Respectfully,

Drew Davis
Navy Veteran and Entrepreneur | GoDaddy Pro user | "Proud to be serving others!"

*** Please note that I offer free advice on this forum. Please feel free to give me KUDOS on this topic/discussion; mark my comment as ACCEPTED SOLUTION if you believe I've helped solved your issue. Thanks! ***
Highlighted

Re: 502 Bad Gateway

I am booting up my Node server with `node index`. It boots up a server/website with express. It also boots up a Discord bot in the same time with that command. I do not have nginx installed. My files are in a folder on my desktop, not a var/www folder.

Highlighted
Super User I
Super User I

Re: 502 Bad Gateway

Sounds like a node.js server configuration error then. It's strange that you said it gave a NGINX error yet it wasn't installed on the VPS.

Very Respectfully,

Drew Davis
Navy Veteran and Entrepreneur | GoDaddy Pro user | "Proud to be serving others!"

*** Please note that I offer free advice on this forum. Please feel free to give me KUDOS on this topic/discussion; mark my comment as ACCEPTED SOLUTION if you believe I've helped solved your issue. Thanks! ***
Highlighted

Re: 502 Bad Gateway

How do I fix this then @davisdre317 ? If you want to see the error I am getting, go to http://vanished.fun.

Highlighted
Super User I
Super User I

Re: 502 Bad Gateway

@vanishedvan ,

 

According to Wappalyzer, you are using Nginx as web server and reverse proxy for that address. So, I would start there first. 


Very Respectfully,

Drew Davis
Navy Veteran and Entrepreneur | GoDaddy Pro user | "Proud to be serving others!"

*** Please note that I offer free advice on this forum. Please feel free to give me KUDOS on this topic/discussion; mark my comment as ACCEPTED SOLUTION if you believe I've helped solved your issue. Thanks! ***